Quicksearch Form issues

vapid2323

Scion
Local time
Today, 10:43
Joined
Jul 22, 2008
Messages
217
To start off I did search lol,

I am useing the Quicksearch demo project, everything is running great!

Now the only issues I am running into is that when you have two fields that are the same the Quicksearch form will not pull the new record, it will just use the data from the first record.

So if I have two records

Name_Address________ID
Ross__20914 SE 281 st_25
Ross__98034 NE 5th st_26

The text boxes will only show the information for the first record.

So I thought to myself the best way to resolve the issue is to change the code so that it finds the ID first, then it will pull the data everytime. I am haveing truble doing that, it think the reason is the code is telling Access that its looking for a text field not a number.

I am quite new with VBA and I can use some help :)

Code:
Option Explicit
Option Compare Database
Private Sub Text2_Change()
Dim vSearchString As String
 vSearchString = Search.Text
 Search2.Value = vSearchString
 Me.QuickSearchCSR.Requery
 
End Sub
Private Sub ClearIt_Click()
On Error GoTo Err_ClearIt
Me.Search = ""
 Me.Search2 = ""
  Me.QuickSearchCSR.Requery
   Me.QuickSearchCSR.SetFocus
Exit_ClearIt_Click:
    Exit Sub
Err_ClearIt:
    MsgBox Err.Description
    Resume Exit_ClearIt_Click
 
End Sub
Private Sub QuickSearchCSR_AfterUpdate()
DoCmd.Requery
Me.RecordsetClone.FindFirst "[Customer Name] = '" & Me![QuickSearchCSR] & "'"[B] <------- This is the line that needs to change (I think)[/B]
If Not Me.RecordsetClone.NoMatch Then
   Me.Bookmark = Me.RecordsetClone.Bookmark
Else
   MsgBox "Could not locate [" & Me![QuickSearchCSR] & "]"
End If
End Sub
Private Sub Search_Change()
Dim vSearchString As String
 vSearchString = Search.Text
 Search2.Value = vSearchString
 Me.QuickSearchCSR.Requery
End Sub
Private Sub Search2_BeforeUpdate(Cancel As Integer)
End Sub
Private Sub Command49_Click()
On Error GoTo Err_Command49_Click
 
    DoCmd.Close
Exit_Command49_Click:
    Exit Sub
Err_Command49_Click:
    MsgBox Err.Description
    Resume Exit_Command49_Click
 
End Sub
Private Sub Search_Click()
End Sub

Any time I change the line of code to "ID" it will give me errors
 

Users who are viewing this thread

Back
Top Bottom