TheSearcher
Registered User.
- Local time
- Today, 13:15
- Joined
- Jul 21, 2011
- Messages
- 342
I have a command button that, when clicked, opens a report. I feed it a unique Trans_Id so that it opens the report with the data that pertains to the form that the user is viewing. The first time I open the report and Trans_Id = 14 it opens the correct report. If I change the Trans_Id to 15 it will sometimes open the 14 report instead (not always). What could be causing the first variable to get stuck? Here is my code:
I, at first, used the Me.txt_TransID instead of the global variable in the DoCmd. Then I changed it to the global when this issue started happening but it didn't seem to have an effect.
Any help will be greatly appreciated.
Thanks in advance,
TS
Code:
Private Sub cmd_ViewNote_Click()
Globals.glb_TransID = Me.txt_TransID
DoCmd.OpenReport "N_Note", acViewPreview, , "Trans_ID = " & Globals.glb_TransID, acWindowNormal
Globals.glb_TransID = 0
End Sub
I, at first, used the Me.txt_TransID instead of the global variable in the DoCmd. Then I changed it to the global when this issue started happening but it didn't seem to have an effect.
Any help will be greatly appreciated.
Thanks in advance,
TS