Online Test Banks
Score higher
See Online Test Banks
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

Codes for Common VBA 2007 Tasks

Part of the Access 2007 VBA Programming For Dummies Cheat Sheet

This list shows you the most common jobs carried out in VBA 2007 and the code statements you need to type to complete the VBA task, 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:


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 design 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 question on-screen:

variable = MsgBox("yourMessage", vbQuestion + vbYesNo)
  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus

Inside Sweepstakes

Win an iPad Mini. Enter to win now!