I'm glad there a question that I can actually answer. But there's more than one thing that needs to be done. This is one way to do it. Go to the database setup wizard and look at the account ledger database after it's set up. Read the directions below and look at those things specifically on the ledger database.
1. Get familiar with the properties box. This can be found by double clicking on the form/report/query in design view or clicking on the form and then clicking the properties button from the toolbar or by right clicking where you want and clicking the properties item form the pull down.
2. Create the form with the design that you want and the space to enter the search criteria.
3. Open the properties box for the entire form (top-left corner). In the data section, item called 'Record Source' make sure this is blank. Delete everything that might be there. In the event section, item 'OnOpen' click on the down arrow on the right and put [Event Procedure] in. then click on the (...) and use the following code:
'The form is ready for entry.
Private Sub Form_Open(Cancel As Integer)
Me.Caption = Forms![FormNameHere].OpenArgs
End Sub
3. Now you can create the report. Use the wizard and once you've got it how you want it you look, then pull up the properties box for the entire report (remember its in the top left) On the record source click on the (...) thing to bring up the query builder. Build a parameter query as the record source entering [Forms]![Whatever the form name is]![whatever the field name is] as the parameter
4. In the properties under events click on 'OnOpen' and enter something like:
'As soon as the report starts to open, open the form to have the query information entered.
Private Sub Report_Open(Cancel As Integer)
DoCmd.OpenForm "Report Equipment Info", , , , , acDialog, "FormNameHere"
If Not IsLoaded("ReportNameHere") Then
Cancel = True
End If
End Sub
'This is supposed to give you the message when there is no data to report, but
'it doesn't work yet.
Private Sub Report_NoData(Cancel As Integer)
MsgBox "Sorry, there aren't any matches to this info!"
Cancel = -1
End Sub
'When the report is closed. Close the form also. Otherwise it'll still be open.
Private Sub Report_Close()
DoCmd.Close acForm, "Report Equipment Info"
End Sub
This should fill in your other events.
5. Now back to the form. Open the properties box for the individual field entries and delete the record source. This should cause 'Unbound' to appear in the place to enter.
6. Now on the form create a control button. In the properties box on the control under 'OnClick' event enter something like.
'Take the focus off the form and back to the report.
Private Sub Preview_Report_Click()
Me.Visible = False
End Sub
I hope this helps.
Kenneth