Output single record

Sgt Bilkp

Registered User.
Local time
Today, 10:59
Joined
Jan 11, 2008
Messages
66
I have a number of forms, all based on different queries. All the forms look the same, but obviously return different record sets depending on the query parameters.

Form1 | Query1
Form2 | Query2
Form3 | Query3
and so on for 3 more forms/queries.

Each Query returns around 100 records from a general total of 600.

I need to a button on each one of the forms that outputs the displayed record to a report. The unique ID for each record is MainDataID.

Any suggestions?
 
On your command button, use something like the following:

Code:
    Dim sDocName As String
    Dim sFilter As String
 
    sDocName = "rptReportName"
    sFilter = "MainDataID = Forms!fFormName!txtControlNameThatHasMainDataID"
    DoCmd.RunCommand acCmdSaveRecord
    DoCmd.OpenReport sDocName, acPreview, , sFilter

Ensure there is a control that has the ID you want on the form (can set to invisible). Substitute all required names.

-dK
 

Users who are viewing this thread

Back
Top Bottom