Print current record WAS working, now not. What is going on?

kbrooks

Still learning
Local time
Today, 03:44
Joined
May 15, 2001
Messages
202
I am going crazy here. I had this db just about ready and was making some slight changes (in appearance only) before rolling it out. I had a user log on and try to use it to see if I was missing anything.

Before, on the form OPRegistration, you clicked a button that saved and then printed the report OPLabels for the current record. The first patient she registered, she clicked this button and got a blank report. (Blank except for headings, I guess.) I honestly don't think I made any changes once I got it working, and in looking at the code and at previous posts here, I can't figure out what's wrong. Hopefully that's enough information for someone much smarter than me to figure this out. Here is the code behind the command button:

Private Sub Command71_Click()
On Error GoTo Err_Command71_Click

DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenReport "OPLabels", , , "[Account] = " & Me![Account]
DoCmd.Close acForm, "OPRegistration"

Exit_Command71_Click:
Exit Sub

Err_Command71_Click:
MsgBox Err.Description
Resume Exit_Command71_Click

End Sub

TIA
 
Wait, I do remember making a change here. The line

DoCmd.OpenReport "OPLabels", , , "[Account] = " & Me![Account]

read:
....[OPAccount] = " & Me![OPAccount]

But that was a typo on my part. There was never a field named OPAccount, so I changed it to just read Account. Did I inadvertantly remove something else I should've have?
 
That's very good to know, Pat, thank you. When I did that and chose the field Account from the list, it didn't put it in brackets. So I ended up with Me.Account Does the brackets matter?

Other than that, does my code appear correct? I have another form that does the exact same thing....just different field name and report name. That one works while this one doesn't. I've compared the code and can't find anything that's different. I'm seriously at a loss here, if anyone can point out something I'm missing.

TIA
 
Well I'm off to get the "IDIOT" tatoo on my forehead. The control source on the form I was trying to print was pointing to the wrong query. :rolleyes: Sorry about that.
 
I hope you did not do the tattoo in a mirror and actually have TOIDI :D
 

Users who are viewing this thread

Back
Top Bottom