Parameter query????

rupes_mahal

Registered User.
Local time
Today, 16:08
Joined
Aug 12, 2001
Messages
60
Hi..

I have a parameter query which brings up a dialog box prompting the user to insert a number (relating to the number of years the user wants to see data about).

The dialog box has a OK and Cancel button on it. The OK button works fine. But the Cancel button does not...it returns an error:

Run-Time error "2001"

You canceled the previous operation

This is the error message which appears.

The query has been added to a button.
the code for that button is:

Private Sub datasheetview_Click()
DoCmd.OpenQuery "DatePartQuery"
End Sub

I don't know what is wrong.....please help...

thankyou in advance

ruby
 
Nothing is wrong. Access is just letting you know that you cancelled the operation. If you want to eliminate the message then change your code to look like this:

Private Sub datasheetview_Click()

On Error GoTo ErrorHandler

DoCmd.OpenQuery "DatePartQuery"

ErrorHandlerExit:
Exit Sub

ErrorHandler:
If Err.Number = 2001 then Exit Sub
Msgbox Err.Number & " " & Err.Description
Resume ErrorHandlerExit

End Sub

[This message has been edited by Jack Cowley (edited 10-19-2001).]
 
Thanks Jack.....it worked.
 

Users who are viewing this thread

Back
Top Bottom