suburbanpsyco
Registered User.
- Local time
- Today, 14:40
- Joined
- Apr 18, 2011
- Messages
- 19
General question about how to get an event to work. I have the following simple code.
It is currently coded behind a button. Works like a charm. Now when i try to move this to the KeyPress event i get: Invalid use of null, on the first line. (If RegexMatch(Me.txtSearch.Value) Then) At first i thought this was just when the original value of the textbox is nothing, but even when there is a value in the box on form load, the same error is given.
Any insight? Thanks in advance
Code:
If RegexMatch(Me.txtSearch.Value) Then
rstReportGenerator.MoveFirst
rstReportGenerator.Find "partNumber >= #" & Me.txtSearch.Value & "#"
If rstReportGenerator.EOF Then
rstReportGenerator.MoveLast
End If
Me.lstParts.Value = rstReportGenerator!partNumber
End If
It is currently coded behind a button. Works like a charm. Now when i try to move this to the KeyPress event i get: Invalid use of null, on the first line. (If RegexMatch(Me.txtSearch.Value) Then) At first i thought this was just when the original value of the textbox is nothing, but even when there is a value in the box on form load, the same error is given.
Any insight? Thanks in advance