Continuous form Button to Open Specific Record

fractals

New member
Local time
Today, 04:40
Joined
Jun 8, 2009
Messages
2
Hello.

I have a continuous form with an open button on each record that will open the details for the record listed. I am using the following code onthe event that the button is clicked:


>>
Private Sub Command177_Click()
Dim LName As Variant
Dim Last As Variant

If Nz(Me!Last, "") <> "" Then
Last = DLookup("ID", "Students", "[Last Name] = '" & Me!Last & "' ")
DoCmd.Close
DoCmd.OpenForm "Student Details", acNormal, , "ID=" & Last

End If
End Sub
<<

Works except it only opens the first record on the continuous form, not the one the button is on. I have searched for an hour to find an answer. Please help!
 

Users who are viewing this thread

Back
Top Bottom