I've read a hodgepodge of suggestions all over the internet for passing global variable info to Access queries but can't make it work for me.
I'm using ACCESS 2010. I have a form with 3 subforms. The subforms are almost identical and each has a button which should open a report. I want to have one report based on one query which receives its criteria based on which of the 3 buttons is pressed.
Here is what I've cobbled together from the various internet searches....
This one problem has held me up for hours. I'd appreciate any help you guys can provide!
I'm using ACCESS 2010. I have a form with 3 subforms. The subforms are almost identical and each has a button which should open a report. I want to have one report based on one query which receives its criteria based on which of the 3 buttons is pressed.
Here is what I've cobbled together from the various internet searches....
Code:
' I create the public variable in a module by itself Public EmplID As String ' Next I ensure I got the global variable value and open a query. You'll see that the report is inactive. Eventually I'll take the MsgBox and query out of the code and just open the report but for now, the query is the problem. Private Sub Command41_Click() MsgBox "global variable " & (EmplID) DoCmd.OpenQuery ("Q_JB_OfferLtr2") 'DoCmd.OpenReport ("R_JB_Job_Offer2"), acViewPreview End Sub ' Then I try to pass the variable to the ACCESS query. On the criteria line I use: = EmplID() ' And I get error 3270, saying "Property not found"
Comment