I am trying to give the users of my database a method to edit an existing record in the database. there is a projects list that is shown on a main form in a listbox, from this list box i want to be able to double click a line and have it open the pop up form that is used to enter the data, but instead of entering the data on a blank form, have the form already populated with the data from the selected listbox entry. Here is what i currently have saved to the double click event for the listbox...
When i run this i get a "Run-Time error '3464': Data type mismatch in criteria expression" and my 'Set rs =.....' line is highlighted. what am i doing wrong here?
Code:
Private Sub lstProjectLog_DblClick(Cancel As Integer)
Dim rs As DAO.Recordset
Dim lngRow As Long
lngRow = -1
Do
lngRow = lngRow + 1
Loop Until (Me.lstProjectLog.Selected(lngRow) = True)
Set rs = CurrentDb.OpenRecordset("SELECT * FROM Projects WHERE P_ID = '" & Me.lstProjectLog.Column(0, "lngRow") & "'", dbOpenDynaset, dbSeeChanges)
DoCmd.OpenForm "Entry_Project", acNormal, , "P_ID = " & rs!P_ID, , acWindowNormal
End Sub
When i run this i get a "Run-Time error '3464': Data type mismatch in criteria expression" and my 'Set rs =.....' line is highlighted. what am i doing wrong here?