DCrake
Remembered
- Local time
- Today, 07:22
- Joined
- Jun 8, 2005
- Messages
- 8,626
Code:
varRP = Me.RPphone
strSQL1 = [COLOR="red"]"SELECT [RPcontactnumber], [RPid]" & _
" FROM ReportingParties" & _
" WHERE [RPcontactnumber] ='" & varRP & "' ;"[/COLOR]
Set db = CurrentDb()
Set LRS = db.OpenRecordset(strSQL1)
If LRS.EOF = False Then
[COLOR="Red"]Me.RPid = DLookup("[RPid]", "ReportingParties", "RPcontactnumber = '" & Me.RPphone & "'")[/COLOR]
Else
DoCmd.OpenForm ("ReportingPartiesForm")
End If
LRS.Close
Set LRS = Nothing
The two highlighted strings are exactly the same.
Why are you doing a lookup on a table that you already have the recrodset set to?
Change the second string to
Code:
Me.RPid = LRS("RPid")