BonusGeezer
09-06-2000, 11:53 AM
from my form i need to run a report that only contains the current record.
All i can get is all records - do i need sql or a query?
Me big idiot help please.
thanx in advance...
Mark_e_y
09-06-2000, 02:19 PM
Are you familiar with VBA?
If so I would do it like this
DoCmd.OpenReport "Report Name", , , "[Unique ID Number on form] = forms![Form Name]![Form field that matches required unique ID nmuber on form]"
A real example of this would look something like this:
Private Sub cmdPrint_Click()
Docmd.OpenReport "rptOrders", , ,"[OrderID] = Forms![frmOrders]![OrderID]
Your report has to be the same as it is now with all the available records in it. The last part of the code above is like a 'WHERE' statement is SQL. Keep an eye on the little help box that pops up as you type to keep you on the right tracks.
Mark_e_y
09-06-2000, 02:21 PM
sorry the I have made an error.
the Sub should look like
Private Sub cmdPrint_Click()
Docmd.OpenReport "rptOrders", , ,"[OrderID] = Forms![frmOrders]![OrderID]"
End Sub
Pat Hartman
09-06-2000, 08:44 PM
One more change.
If the OrderID is text
Docmd.OpenReport "rptOrders", , ,"[OrderID] = '" & Forms![frmOrders]![OrderID] & "'"
or If the OrderID is numeric Docmd.OpenReport "rptOrders", , ,"[OrderID] = " & Forms![frmOrders]![OrderID]