I've developed a form with an unbound txtbx and a subform that behaves exactly like the Access 97 Help Index pop-up form. The unbound txtbx is used as the look-up field for the records displayed in the subfrm where I display 4 records at a time. As in the help index pop-up form, the keystrokes entered by a user display the sbfrm records that are the closest match to the text entered. My problem is in using the .FindFirst method for the recordset I open in the code behind the OnChange event for the txtbx: it doesn't survive the user entering a doublequote or a left bracket and who knows what other characters.
I'm using this syntax:
Private Sub txtLkUp_Change()
...variable & rst declarations
With rstLstNme
If Len(Me![txtLkUp].Text) = 0 Then
.MoveFirst
GoTo Mrk1
End If
strLkUpLC = LCase(Me![txtLkUp].Text)
StrLkUpFnd = Chr$(34) & strLkUpLC & Chr$(42) & Chr$(34)
.FindFirst "[FullNme] Like " & StrLkUpFnd
...etc
Is there a syntax for the .FindFirst method that doesn't blow up for ANY character the user might enter or do I have to trap for characters as they are entered (I've noticed the left bracket only causes an error if it is the first character entered in the txtbx...)? If I have to trap for characters, what syntax saves the most code?
Comments appreciated,
Doug.
I'm using this syntax:
Private Sub txtLkUp_Change()
...variable & rst declarations
With rstLstNme
If Len(Me![txtLkUp].Text) = 0 Then
.MoveFirst
GoTo Mrk1
End If
strLkUpLC = LCase(Me![txtLkUp].Text)
StrLkUpFnd = Chr$(34) & strLkUpLC & Chr$(42) & Chr$(34)
.FindFirst "[FullNme] Like " & StrLkUpFnd
...etc
Is there a syntax for the .FindFirst method that doesn't blow up for ANY character the user might enter or do I have to trap for characters as they are entered (I've noticed the left bracket only causes an error if it is the first character entered in the txtbx...)? If I have to trap for characters, what syntax saves the most code?
Comments appreciated,
Doug.