dommac82
asked on
Error when code runs
Hi Experts,
Thank you for your time and effort.
The code below is attached to a command button. I have used similar code before and it has worked.
In fact when I created the code last week it was working. Now for some reason I get an error message: "You cancelled the previous operation".
Any thoughts
Thank you for your time and effort.
The code below is attached to a command button. I have used similar code before and it has worked.
In fact when I created the code last week it was working. Now for some reason I get an error message: "You cancelled the previous operation".
Any thoughts
Private Sub Location_by_Variety_by_Age_Report_Click()
On Error GoTo Err_Location_by_Variety_by_Age_Report_Click
Dim LVAqry As String
Dim LVArpt As String
LVAqry = "Blueberry Location by Variety by Age Report Query"
DoCmd.OpenQuery LVAqry, acViewNormal, acReadOnly
LVArpt = "Blueberry Location by Variety by Age Report"
DoCmd.OpenReport LVArpt, acPreview
Exit_Location_by_Variety_by_Age_Report_Click:
Exit Sub
Err_Location_by_Variety_by_Age_Report_Click:
MsgBox Err.Description
Resume Exit_Location_by_Variety_by_Age_Report_Click
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
"Grade: A - "Thanks for your example MX. I removed the On error line and re ran the code; this brought up the debugger, which highlighted the DoCmd.OpenQuery line, so I checked the query and there was an error in a calculation that was preventing it from running." "
Yep ... another perfect example of how you can get that error. Thanks for posting the result ... appreciate that.
mx
Yep ... another perfect example of how you can get that error. Thanks for posting the result ... appreciate that.
mx
ASKER
You really deserve you rank
ASKER