Unanswered: Search for specific record using VBA in a subform
I have a company database (Access 2003) with two sub forms, one an entry form to add members of staff against the company the second is a summary that shows all the staff for the comany in a datasheet view.
The summary view isn't editable but the entry form is so Im trying to write some VBA so that I can doubdle click the Staff ID number in the summary form and it will find the correct record in the entry subform.
So far this is what I have
Private Sub Staff_ID_DblClick(Cancel As Integer)
Dim Staff_ID As Long
''Set focus on summary subform staff ID
''Variable to hold summary subform staff ID number
StaffNo = Staff_ID
''Setting focus to relevant filed in editable subform
''Find Staff record
DoCmd.FindRecord StaffNo, , , , , acCurrent
The problem I have is I have no idea if the variable has the correct data if any and Im not sure if the search is working.
The code certainly selects the required field but no the required record.