Report from a form

Design by Sue

Registered User.
Local time
Today, 15:53
Joined
Jul 16, 2010
Messages
816
I have created a report based on a query. Both have the fields Employee Number, First Name and Last Name - with other fields not important for this question. I am trying to create a form to open the report that is based on the client selecting the First and Last Names. What I have done so far is create a combo box with the three columns, Employee Number in column 0, Last name in 1 and first name in 2. The employee number column is hidden so the user gets a drop down showing a column of last name then first name to select from. I have created a button to open the report but no matter what combination of coding I have tried I can't get the report to open from the input on the form. The most recent code I tried is to match up the employee number fields. Here is what I have.


Private Sub Open_Click()
On Error GoTo Err_Open_Click

Dim stDocName As String

stDocName = "Employee Training RPT"
DoCmd.OpenReport stDocName, acPreview
Me.LastName.Column(0) = Reports![Employee Training RPT]![Employee #]

Exit_Open_Click:
Exit Sub

Err_Open_Click:
MsgBox Err.Description
Resume Exit_Open_Click

End Sub

Please help with the criteria and how to program it. Once I get this I can complete the rest of this project which I have an impossible deadline on!~

Thanks
Sue
 

Users who are viewing this thread

Back
Top Bottom