Visual Basic For Applications: Pass a parameter to a form or report

Platform:Visual Basic For Applications
Task:Pass a parameter to a form or report
Discussion:
Sometimes you need to pass a parameter to a form or report. Here's how.
Example:
'pass the parameter in through the code that opens the form
DoCmd.OpenForm "frmBrownBearSurveyData", acFormDS, , "SurveyID = '" & SurveyID & "'", , , "My Parameter"


'retrieve it through the OpenArgs value
msgbox(OpenArgs)
'or maybe determine if the parameter exists and plot an alternate course of action
=IIf(Len([OpenArgs])>0,[OpenArgs],[Firstname] & " " & [lastname])
Back to Index