Search Textbox not responding

  • Thread starter Linda W. via AccessMonster.com
  • Start date
L

Linda W. via AccessMonster.com

I have a text box on my for named "TextJO". I'm using it to search for
either a Job order number or the tracking number. The Job order number has a
hyphen so I'm using it as text field. But when I enter a job number or a
tracking no, it does nothing. Here's my code.

Private Sub TextJO_AfterUpdate()
Dim rs As Object
Set rs = Me.RecordsetClone

If Val(Me.TextJO) = 0 Then
'(Name Search code goes here)
rs.FindFirst "JobOrder = """ & [TextJO] & """"
If Not rs.NoMatch Then Me.Bookmark = rs.Bookmark
Else
'(Number Search code goes here)
rs.FindFirst "TrackingNo = " & Str(Nz(Me![TextJO], 0))
If Not rs.NoMatch Then Me.Bookmark = rs.Bookmark
End If


End Sub

Thanks,
Linda
 
M

Marshall Barton

Linda said:
I have a text box on my for named "TextJO". I'm using it to search for
either a Job order number or the tracking number. The Job order number has a
hyphen so I'm using it as text field. But when I enter a job number or a
tracking no, it does nothing. Here's my code.

Private Sub TextJO_AfterUpdate()
Dim rs As Object
Set rs = Me.RecordsetClone

If Val(Me.TextJO) = 0 Then
'(Name Search code goes here)
rs.FindFirst "JobOrder = """ & [TextJO] & """"
If Not rs.NoMatch Then Me.Bookmark = rs.Bookmark
Else
'(Number Search code goes here)
rs.FindFirst "TrackingNo = " & Str(Nz(Me![TextJO], 0))
If Not rs.NoMatch Then Me.Bookmark = rs.Bookmark
End If


Val will not return 0 unless the job number starts with a
non numeric character. You may be better off using:

If Me.TextJO Like "*[!0-9]*" Then
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Search Text Box 1
Search Using Textbox 1
Textbox Filter 4
Search function with two combos and "and" 2
rs.FindFirst limits? 3
lost focus...? 3
FindFirst method not found 2
MSAccess 2000 -- Error 91 problem 7

Top