P
Patrick
HI!!
I'm looking for a search engine that would cycle through
the contents of a specific column and move the form to
that location.
Example:
Looking For lastName="Doe", then if it finds a match the
form navigation is sent to that record, else does
nothing ,a warning to user is given.
It would be greate if it could work for the following
problems as well:
Last Name: O'Ray ' Should take into account the ' sign.
last Name: James ' should work regardless if its a 'J'
or 'j'. Not case sensitive.
And, if the user just needs to find the records starting
with the letter 'J' it should position to the first of
those records.
Right-bow, the code I have doesn't do a lot for me.
Here a copy of the code if it can help my situation.
Dim dbs As Database
Dim rsnew As Recordset
Dim idx As Integer
Dim cpt As Boolean
Dim reponse2, reponse3 As String
On Error Resume Next
reponse2 = strRep & "*"
reponse3 = UCase(strRep) & "*"
If IsNull(strRep) Or strRep = "" Then
' exit.
Else
Set dbs = CurrentDb
Set rsnew = dbs.OpenRecordset("SELECT * " _
& " FROM [t Ortho Data]")
With rsnew
.MoveFirst
While Not .EOF
If .Fields(lookUpName) Like reponse2 then
cpt = True
idx = .AbsolutePosition
GoTo skip
End If
.MoveNext
Wend
End With
skip:
If cpt Then
idx = idx + 1
cpt = False
DoCmd.GoToRecord acDataForm, "frmfurniture", acGoTo, idx
Else
MsgBox"No data found for " & strRep & ",try again!"
End If
reponse2 = ""
strRep = ""
End If
End Function
Any help would be appreciated,Thanks in advance,
PAtrick
I'm looking for a search engine that would cycle through
the contents of a specific column and move the form to
that location.
Example:
Looking For lastName="Doe", then if it finds a match the
form navigation is sent to that record, else does
nothing ,a warning to user is given.
It would be greate if it could work for the following
problems as well:
Last Name: O'Ray ' Should take into account the ' sign.
last Name: James ' should work regardless if its a 'J'
or 'j'. Not case sensitive.
And, if the user just needs to find the records starting
with the letter 'J' it should position to the first of
those records.
Right-bow, the code I have doesn't do a lot for me.
Here a copy of the code if it can help my situation.
Dim dbs As Database
Dim rsnew As Recordset
Dim idx As Integer
Dim cpt As Boolean
Dim reponse2, reponse3 As String
On Error Resume Next
reponse2 = strRep & "*"
reponse3 = UCase(strRep) & "*"
If IsNull(strRep) Or strRep = "" Then
' exit.
Else
Set dbs = CurrentDb
Set rsnew = dbs.OpenRecordset("SELECT * " _
& " FROM [t Ortho Data]")
With rsnew
.MoveFirst
While Not .EOF
If .Fields(lookUpName) Like reponse2 then
cpt = True
idx = .AbsolutePosition
GoTo skip
End If
.MoveNext
Wend
End With
skip:
If cpt Then
idx = idx + 1
cpt = False
DoCmd.GoToRecord acDataForm, "frmfurniture", acGoTo, idx
Else
MsgBox"No data found for " & strRep & ",try again!"
End If
reponse2 = ""
strRep = ""
End If
End Function
Any help would be appreciated,Thanks in advance,
PAtrick