new - idiot - help

  • Thread starter Thread starter BonusGeezer
  • Start date Start date
B

BonusGeezer

Guest
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...
 
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.
 
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
 

Users who are viewing this thread

Back
Top Bottom