Printing Reports

Frankythekid

Registered User.
Local time
Today, 09:34
Joined
Dec 28, 2004
Messages
10
I'm trying to print a specific report, not the whole list. I'm using the preview function first but it will show all records.
Currently I'm using this code:

Private Sub Command89_Click()
DoCmd.OpenReport "PO Log", acViewPreview, "[PO Number]=Forms!PO Log![PO Number]"
End Sub

But it shows all of the records, I just need the one with the PO Number i'm currently working on, only that one. So I can choose print and only print that record.
I guess this is a silly question, but i don't know why it will not work.

I appreciate the help...
 
Franky,

You need to isolate the Forms... reference so that Access can substitute
the real value of [PO Number]. And I think you missed a comma.

Code:
Private Sub Command89_Click()
  DoCmd.OpenReport "PO Log", acViewPreview,,"[PO Number] = " & Forms![PO Log]![PO Number]"
End Sub

Wayne
 
thanks for the help again Wayne.

I wrote the same thing:

Private Sub Command89_Click()
DoCmd.OpenReport "PO Log", acViewPreview,,"[PO Number] = " & Forms![PO Log]![PO Number]"
End Sub

But the Do.Cmd line is in RED and it won't work, I guess is something in the syntax, but I don't know too much of programing in VBA.

Can you also recomend me a good book so I can learn how to program access 2000 using VBA. I just think that the only way to make my database better is by using this type of programming.

thanks again
 

Users who are viewing this thread

Back
Top Bottom