HarringtonBell
asked on
Print Report Using Query
I am using the following code with a button on my switchboard
It is supposed to prompt the user for a number (in this case a receipt number) and then parses the reciept number to the report and prints out the duplicate receipt. However I have tried many variations and get either a syntax error or it repeats the most current receipt.
I would appreciate it if someone could help me fix this code please
It is supposed to prompt the user for a number (in this case a receipt number) and then parses the reciept number to the report and prints out the duplicate receipt. However I have tried many variations and get either a syntax error or it repeats the most current receipt.
I would appreciate it if someone could help me fix this code please
Dim MyValue As Variant
MyValue = InputBox("Type in the receipt number, to be printed.", "Print a duplicate receipt")
If MyValue = "" Then
MsgBox "The duplicate receipt is cancelled."
Exit Function
End If
DoCmd.OpenReport "dupreceipt", acViewNormal, , "ReceiptNo = MyValue"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What data type is the receipt number?
ASKER
receipt type is a number field
ASKER
I am awarding these points since the answer is correct, however the reason it wasn't working is because the form is linked to a qry that was had specific criteria attached the receipt field. I now have it working correctly though
ASKER
I am awarding these points since the answer is correct, however the reason it wasn't working is because the form is linked to a qry that was had specific criteria attached the receipt field. I now have it working correctly though
ASKER
Do you have any other ideas?