Report Filter

eyalco

Registered User.
Local time
Today, 05:04
Joined
Jul 24, 2007
Messages
50
Hi everyone.
I'm trying to print the last record in a table but the report seems to come up with no details, as if the table is enpty (it's not).
The code i'm using is :
DoCmd.OpenReport "rpt_invoice", acViewPreview, , "[invoice_no]=" & Me!INVOICE_NO

I tried to use the DMAX as to show the last record (by a query) but it doesn't recognize it.
Can anyone assist please?
Thanks.
 
For that to work, the form would have to be on the record in question. Is it? Also, invoice_no would have to be a numeric data type.
 
Thanks.
The Invoice_no is of course a numeric data but I'm not sure I follow you regarding the form would have to be on the record in question - in what way?
 
Eyalco

Your example, only prints the record CURRENTLY displayed, try:

DoCmd.OpenReport "rpt_invoice", acViewPreview, , "[invoice_no] = " & DMax("[INVOICE_NO]", "YourTable")

Wayne
 
Thanks, it helps.

I seem to have another problem - I need to print the current form (invoice) so I'm saving it after dmax+1.

The saving code I'm using is :

"DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70"

The problem is that it doesn't saved the current record so I'm printing the former record (and when I enter a different record, it prints the former).

How can I save the current record on the form so the DMAX+1 no. for invoice is the last one printed?

Thanks.
 

Users who are viewing this thread

Back
Top Bottom