Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax help!

Status
Not open for further replies.

alec

Programmer
Mar 7, 2001
21
US
I'm new o VBA, I used to program with coldfusion, I need someone nice to help me out with syntax so I can continue make sense of the codes in front of me, thanks!

1. If
IsNull(Me!txtBudgetID)
Then
MsgBox "You must enter a BudgetID!",
vbExclamation, "Missing BudgetID"
Exit Sub

Else
Set Mydb = CurrentDb
Me!OTYPE = &quot;2&quot; <--- WHAT DOES THIS MEAN? and
WHAT DOES IT DO?

I can see OTYPE in the drop down Object box, if I choose this object from object box, than my insertion point will be in:

Private Sub OTYPE_BeforeUpdate(Cancel As Integer)

End Sub
----> Is this a procedure? if yes what does it do? why there is no code between Private Sub and End Sub???

2. In option explicit section I have:
Dim LinkCriteria As String
then in few section below I have:
LinkCriteria = &quot;[BudgetID] = &quot; & Me![txtBudgetID]

My question is:
&quot;[BudgetID] = &quot; ---> WHAT DOES THIS SYNTAX MEAN?
Does it mean: assign to the
variable name LinkCriteria the
value of Column called:BudgetID?

3. Forms!frmDevelop514Calc!
fsubDevelop514Calc.Form!
lblAmt2.Caption = Trim(Str$(Forms!frmFY!txtFY - 2))

WHAT DOES fsub mean? does it mean a sub form just
like frmsomething?

Thank you so much for your input! Alec
 
1. OTYPE is a control on the form.

to find out which one, look at the properties of your text boxes, combo boxes, option groups etc....

2. I don't have your form in front of me, so I'm not too sure. but it sounds like it's a subform.

HTH
 
2. LinkCriteria = &quot;[BudgetID] = &quot; & Me![txtBudgetID]
The LinkCriteria variable is being assign a string value consisting of the concatenation of the string &quot;[BudgetID] = &quot; and the current value of the txtBudgetID control on the form.

The brackets around &quot;txtBudgetID&quot; are optional in this case; they're required only around an object name that contains a space, ampersand, or other character that would be misinterpreted. Many programmers use them all the time, kind of as a signal that it's an object name and not a variable.

&quot;[BudgetID] = &quot; is in quotes, so it's just a string literal. It will probably be interpreted later by SQL, and refers to a field in some table. Again, the brackets would be optional.

Psychpt's answer to #3 is true, but not precise. &quot;fsubDevelop514Calc&quot; is probably the name of a subform control, not actually the name of a subform. The subform's form name will be in the control's Source Object property. Note that the &quot;fsub&quot; prefix has no syntactic meaning; it's merely a popular naming convention in VBA. Rick Sprague
 
I like to thank Psychpt and Rick Sprague for helping me explain the syntax. I appreciate it very much! Alec
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top