Report on current record

  • Thread starter Thread starter Daniel
  • Start date Start date
D

Daniel

Hi Guys.

I'm trying to run a report on the currently viewed record in my form.

This is the VBA that I'm currently using


Private Sub Command211_Click()
DoCmd.OpenReport "Fax Reminder Form", acViewPreview, , _
"[EmployeeIdentifier]=Forms!frmEmployee_Details_Form![EmployeeIdentifier]"

End Sub
Fax Reminder Form is the name of my report
EmployeeIdentifier is the unique field used to identify the record

For some reason using the code brings up the very first record in my table.

Here is my SQL if that helps


SELECT [Employee Details].FirstName, [Employee Details].Surname, [School
Details].Principal, [Employee Details].EmployeeIdentifier
FROM [Employee Details], [School Details];
 
Concatenate the value from the form into the WhereCondition string:
"[EmployeeIdentifier] = " &
Forms!frmEmployee_Details_Form![EmployeeIdentifier]

More info on ensuring the record is saved, there is a record, and the data
types are correct here:
Print the record in the form
at:
http://allenbrowne.com/casu-15.html
 
Back
Top