Printing A refport based on Form ID number

dubmunkey

Registered User.
Local time
Today, 14:13
Joined
Jan 6, 2006
Messages
62
Hi all,

Im trying to print a report from a form. I want the report to have the contents of the forms current record.

The underlying table has an autonumber as it's index/primary key and it's this im referencing. What happens is a record is saved and the autonumber is generated.


DoCmd.OpenReport stDocName, acPreview, , Me.RefID.Value ' the value of the forms id box

= [RefId]' the value on the report

The problem i have is this:

when i ask it to return the record which shares the id number of the current form record i get a blank report with no error.

when i ask it to return the record equal to a specific record number - by swapping the varibale for a fixed value i get all records- can anyone suggets what is going on here?

greg
 
here is the code:

Dim stDocName As String
stDocName = "Referral Slip"
DoCmd.OpenReport stDocName, acPreview, , Me.RefID.Value = RepRefId

greg
 
Try:
DoCmd.OpenReport stDocName, acPreview, , "[RefID] = " & Me.RefID
 
cheers, i had put my quotes in the wrong place.

ta

greg
 

Users who are viewing this thread

Back
Top Bottom