Save & print

eyalco

Registered User.
Local time
Yesterday, 22:43
Joined
Jul 24, 2007
Messages
50
I am creating a record in the form - I wish to save it and print it right away. The problem is that it doesn't. How do I save and print (I know the save code and the print code - the problem is combining them).
I tried using the print code in the after update event but is shows an error.

Can someone assist please?
 
I am creating a record in the form - I wish to save it and print it right away. The problem is that it doesn't. How do I save and print (I know the save code and the print code - the problem is combining them).
I tried using the print code in the after update event but is shows an error.

Can someone assist please?

You need to include more information -

What, exactly, was the code were you trying to use and what was the text of the error message?
 
Thanks.
This is the save cmd :
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

filtering the record to the report :
Dim strReportName As String
Dim strCriteria As String
If NewRecord Then
MsgBox "This record contains no data." _
, vbInformation, "Invalid Action"
Exit Sub
Else
strReportName = "rpt_invoice"
strCriteria = "[invoice_no]= " & Me![INVOICE_NO]

DoCmd.OpenReport strReportName, acViewPreview, , strCriteria
End If

This is the error message :
RUN-TIME ERROR 3075. EXTRA IN QUERY EXPRESSION
'(=[INVOICE_NO])'.

When I take of the print order from the after update, the error goes away but there's no record to print.

Help??
 
1. You should move away from the DoMenuItem code. The best way to save a record is with
Code:
DoCmd.RunCommand acCmdSaveRecord

2. Have you tried setting a breakpoint to see if the code actually runs the way you are thinking it is supposed to run?
 
It works, didn't need the breakpoint - it was the new save cmd you gave.
Can you pleas explain what's the reason for changing the save cmd? Why wasn't mine good?
Thanks for the fast reply ..
 
It works, didn't need the breakpoint - it was the new save cmd you gave.
Can you pleas explain what's the reason for changing the save cmd? Why wasn't mine good?
Thanks for the fast reply ..

Microsoft has officially deprecated the old DoMenuItem commands, although they are supposedly available to support existing use of them. But, I don't know exactly why that would be the case, unless you are on Access 2007 for which they might not be available now.
 
Another Prob.

I deleted all files from the query to start again but now I'm getting another call : the error :
extra) in query expression '([invoice_no]=)'.

What is that please? I checked the report (based on a query) and all ok.

Thanks.
 

Users who are viewing this thread

Back
Top Bottom