I have a form that has a list box and several textboxes. Clicking on a person will display his/her info in the textboxes. When I open the form though it displays the info of the first record. I like it to open with a new record. If I set the DataEntry property to Yes, it won't allow me to click an option in the listbox and display the info. I get runtime error 3021 - No current record
This form opens from another form with a button with the following code on the On Click event
--------------------------
Private Sub Command0_Click()
On Error GoTo Err_Command0_Click
Dim stDocName As String
Dim stLinkCriteria As String
Me.Visible = False
stDocName = "frmMyForm"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command0_Click:
Exit Sub
Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click
End Sub
----------------------
The code in the After Update event for the listbox is
---------------------
Private Sub List3_AfterUpdate()
' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[PersonID] = " & Me![List3]
Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub
Suggestions
This form opens from another form with a button with the following code on the On Click event
--------------------------
Private Sub Command0_Click()
On Error GoTo Err_Command0_Click
Dim stDocName As String
Dim stLinkCriteria As String
Me.Visible = False
stDocName = "frmMyForm"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command0_Click:
Exit Sub
Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click
End Sub
----------------------
The code in the After Update event for the listbox is
---------------------
Private Sub List3_AfterUpdate()
' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[PersonID] = " & Me![List3]
Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub
Suggestions