You cancelled the previous operation msg

Boomshank

Registered User.
Local time
Today, 22:29
Joined
Feb 20, 2009
Messages
29
Hello,

I am trying to create a form that loads up text boxes with a number taken from a query. the code i am using is

Code:
Dim stDocName As String


    stDocName = "Total Pages by Printer"
    DoCmd.OpenQuery stDocName, acNormal, acEdit

Which opens my query. I then have to enter a date is dd/mm/yyyy format
then the code im using is

Code:
Prtr = DLookup("[Mailpieces]", "Total Pages by Printer", "[Printer]= CS1")
 

DoCmd.Close acQuery, "Total Pages by Printer", acSaveNo

But i keep having an error message appear saying that i have cancelled the previous operation. I have tried the code without the close query code but the same error message appears.

Any ideas?
 
Wild guess but perhaps worth trying when the rational suggestions don't succeed. ;)

Could it be something to do with date format problems?
When it falls over it returns a Cancel somehow.

If you are inserting the value of your date variable directly into an SQL statement it needs to be formatted #MM/DD/YYYY# regardless of the date system on the PC.
 
You will get that message if the DLookup returns a Null. You might need to encapsulate that function inside of the NZ function to handle it if it returns a null.
 
Try adding single quotes:
Prtr = DLookup("[Mailpieces]", "Total Pages by Printer", "[Printer]= 'CS1'")
 

Users who are viewing this thread

Back
Top Bottom