JHMarshIII
Registered User.
- Local time
- Today, 15:00
- Joined
- Feb 8, 2002
- Messages
- 19
The following code fails with Data Type Mismatch at the statement:
.FindFirst "[mid] = '" & Me![MemIDLU] & "'"
mid is a autonum (long integer) so I assumed it was the quotes. MemIDLU is a control on a form. But if I remove the quotes, then I get MemIDLU is not a field or expression in the DB. I tried:
.FindFirst [mid] = " & Me![MemIDLU] & "
Yet if I float over the field in the debugger, it shows the value keyed in the form.
I guess I need help with making this code work with long integers
Thanks John ...
---------------------------------------------
Private Sub MemIDLU_AfterUpdate()
' code needs a reference to the dao object library
' Find the first record that matches exactly
' the contents of control [MemIDLU]
With Me.RecordsetClone
.FindFirst "[mid] = '" & Me![MemIDLU] & "'"
If Not .NoMatch Then
' there's a match
' synchronize the form with it's recordsetclone's bookmark
Me.Bookmark = .Bookmark
' Set focus on the Salut control
Me("Salut").SetFocus
Else
' no match
'clear the MemIDLU control
Me("MemIDLU") = Null
' Set focus back on the MemIDLU control
Me("MemIDLU").SetFocus
End If
End With
End Sub
.FindFirst "[mid] = '" & Me![MemIDLU] & "'"
mid is a autonum (long integer) so I assumed it was the quotes. MemIDLU is a control on a form. But if I remove the quotes, then I get MemIDLU is not a field or expression in the DB. I tried:
.FindFirst [mid] = " & Me![MemIDLU] & "
Yet if I float over the field in the debugger, it shows the value keyed in the form.
I guess I need help with making this code work with long integers
Thanks John ...
---------------------------------------------
Private Sub MemIDLU_AfterUpdate()
' code needs a reference to the dao object library
' Find the first record that matches exactly
' the contents of control [MemIDLU]
With Me.RecordsetClone
.FindFirst "[mid] = '" & Me![MemIDLU] & "'"
If Not .NoMatch Then
' there's a match
' synchronize the form with it's recordsetclone's bookmark
Me.Bookmark = .Bookmark
' Set focus on the Salut control
Me("Salut").SetFocus
Else
' no match
'clear the MemIDLU control
Me("MemIDLU") = Null
' Set focus back on the MemIDLU control
Me("MemIDLU").SetFocus
End If
End With
End Sub