This list which shows you the most common jobs performed in VBA and the statements you need to type to get the VBA task completed, so keep this list handy:
Open a form in Form view:
DoCmd.OpenForm "formname",acNormal
Change a form property on an open form:
Forms![formName].propertyName = newValue
Get value from a control on an open form:
Forms![formName]![controlName].Value
Change value of a control on an open form:
Forms![formName]![controlName].Value = newValue
Change a control property on an open form:
Forms![formName]![controlName].propertyName = newValue
Close a form, saving changes:
DoCmd.Close acForm, "formName", acSaveYes
Print a report:
DoCmd.OpenReport "reportName", acViewNormal
Run an action query:
DoCmd.RunSQL "SQLstatement"
Show a simple message:
MsgBox "yourMessage"
Ask a yes/no question onscreen:
variable = MsgBox("yourMessage", vbQuestion + vbYesNo)
dummies
Source:http://www.dummies.com/how-to/content/common-code-for-vba-programming-and-debugging-in-a.html
No comments:
Post a Comment