Advertisement
Online Test Banks
Score higher
See Online Test Banks
eLearning
Learning anything is easy
Browse Online Courses
Mobile Apps
Learning on the go
Explore Mobile Apps
Dummies Store
Shop for books and more
Start Shopping

Common Code for VBA Programming and Debugging in Access

Part of the Access VBA Programming For Dummies

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)
  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus
Advertisement
Advertisement

Inside Dummies.com

Dummies.com Sweepstakes

Win an iPad Mini. Enter to win now!