Solved Passing ID from Form to Report (1 Viewer)

JamieRhysEdwards

New member
Local time
Today, 21:31
Joined
Mar 26, 2022
Messages
27
Hi All,

I'm trying to open a Report in which it'll take the ID of the previous "Contact Details" form. This is what I currently have:

Code:
Private Sub CmdNewStarterReport_Click()
    DoCmd.OpenReport "ReportNewStarter", acViewPreview, , "ID='" & Me.ID & "'"
End Sub

However, when I tap the button, it still asks for the ID. I don't think I'm using this function properly. The "Contact Details" form is getting its data from a QueryContactsExtended query (which houses the ID of the subject)
 

JamieRhysEdwards

New member
Local time
Today, 21:31
Joined
Mar 26, 2022
Messages
27
I know something is wrong XD however, I'm not sure how I would even be able to make a sample db with this problem is as it's likely going to work...
 

JamieRhysEdwards

New member
Local time
Today, 21:31
Joined
Mar 26, 2022
Messages
27
Yeah... Knew this would happen. The reason it was asking for the ID is because I hadn't set the Record Set on the Report itself.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 21:31
Joined
Jul 9, 2003
Messages
14,652
I note you have answered your own question, however, I thought this may be of interest:-

In this YouTube video I demonstrate how to pass a filter into a Report from a Form no code required in the Report:-


I have a blog on filtering which may be of interest:-

 

Users who are viewing this thread

Top Bottom