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!
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!