I have been looking up a ton of threads on this form trying to get exactly what I need but I still can't figure it out with what I've found. I'm sorry if this simple question has already been answered...
I have a report called CDIBReport which is fed from a query called CDIBQuery which contains data from two tables (Files & Members). I then have a main form with 3 subforms containing data from the two said files and another two (which are irrelevant for the report). When I pull up a record in the main and sub forms, some of them have information under the tab that contains the subform with member information (if they are a "member"). I want to be able to run the CDIBReport to create a report based on the "member_number" field in the Members_Subform. That means that I should have only one record showing up in the report as there is only one member number in the subform and every member number is unique.
I have a button on the Members_Subform which I want to click on to create the form. If, however, there isn't any data in the member_number field-there should be no report created (just a DoCmd.beep is what I want to put there if nothing should show up).
I've tried a ton of different code with this but haven't received many good results. I've had it to where I can print the report but it prints out all records in the query. Oh yeah, all of the tables are related by one Primary Key which is "FileID".
Here is the code I've been trying to work with:
Private Sub cmdEnrollmentCDIB_Click()
If Me.member_number.Value Is Null Then
DoCmd.Beep
Else
DoCmd.OpenReport "CDIBReport", acViewPreview, , FileID = Me.FileID, acWindowNormal
End If
End Sub
I'm not great at this coding thing yet so I might just be missing something but I would appreciate any help that anyone could give. Thank you!
I have a report called CDIBReport which is fed from a query called CDIBQuery which contains data from two tables (Files & Members). I then have a main form with 3 subforms containing data from the two said files and another two (which are irrelevant for the report). When I pull up a record in the main and sub forms, some of them have information under the tab that contains the subform with member information (if they are a "member"). I want to be able to run the CDIBReport to create a report based on the "member_number" field in the Members_Subform. That means that I should have only one record showing up in the report as there is only one member number in the subform and every member number is unique.
I have a button on the Members_Subform which I want to click on to create the form. If, however, there isn't any data in the member_number field-there should be no report created (just a DoCmd.beep is what I want to put there if nothing should show up).
I've tried a ton of different code with this but haven't received many good results. I've had it to where I can print the report but it prints out all records in the query. Oh yeah, all of the tables are related by one Primary Key which is "FileID".
Here is the code I've been trying to work with:
Private Sub cmdEnrollmentCDIB_Click()
If Me.member_number.Value Is Null Then
DoCmd.Beep
Else
DoCmd.OpenReport "CDIBReport", acViewPreview, , FileID = Me.FileID, acWindowNormal
End If
End Sub
I'm not great at this coding thing yet so I might just be missing something but I would appreciate any help that anyone could give. Thank you!