Data from form to report.

2ippy

Newbie Here, Be gentle.
Local time
Today, 15:02
Joined
Nov 10, 2006
Messages
78
I'm trying to use a button to clear and then filter a report, with 2 variables.

CustomerID and ItemID

And then print, from a form i have.

Code:
Private Sub Command86_Click()
    Dim stDocName As String
    Dim SupID
    Dim SupID2

    SupID = Me![CustomerID]
    SupID2 = Me![ItemID]
    stDocName = "Receipt"
    DoCmd.OpenReport stDocName, , , , acFormAdd
    Reports![Receipt]!CustomerID = SupID
    Reports![Receipt]!ItemID = SupID2

Tried to use a similar code used from a form to form, but I'm quite useless :rolleyes:
 
You need to set the report's filter property to something like:
"CustomerID = '" & SupID & "' and ItemID = '" &SupID2 & "'"
If these IDs are numeric instead of text, eliminate the single quotes.
 
it's ok the code i was using is crap, i've replaced it with sommat really short :D
 
Last edited:

Users who are viewing this thread

Back
Top Bottom