Harry Shmedlap
Registered User.
- Local time
- Today, 23:36
- Joined
- Aug 9, 2005
- Messages
- 51
The above great article on the Allen Browne site has one problem. I don't know if someone has posted it before but if the lookup is text rather than numeric then search is not found.
Here is a modified version:
Sub Form_Load()
Dim varID As Variant
Dim searchString As String
varID = DLookup("Value", "tblSys", "[Variable] = 'CustomerIDLast'")
If IsNumeric(varID) Then
searchString = "[CustomerID] = " & varID
Else
searchString = "[CustomerID] = " & "'" & varID & "'"
End If
With Me.RecordsetClone
.FindFirst searchString
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With
End Sub
Here is a modified version:
Sub Form_Load()
Dim varID As Variant
Dim searchString As String
varID = DLookup("Value", "tblSys", "[Variable] = 'CustomerIDLast'")
If IsNumeric(varID) Then
searchString = "[CustomerID] = " & varID
Else
searchString = "[CustomerID] = " & "'" & varID & "'"
End If
With Me.RecordsetClone
.FindFirst searchString
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With
End Sub