select record combo box is selecting wrong records HELP!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form with several unbound combo boxes to search for a client:

Enter Birthdate
Enter SS#
Enter Name
Enter ID

The user can search for a client and then use a command key to edit or add a
new record for the client.

The problem is that most of the time you get the correct person when you
enter the seach criteria, but not all of the time.

I have created a refresh button so that when the database seems to become
confused the user can press the refresh button, which refreshes the screen
and clears all of the combo box selections.

This is an okay temporary solution, but I need a permanent solution - the
combo boxes need to be pulling correct data with each search.

Can anyone help?
 
It's all about the code behind the "search" button. If you put a SQL
statement behind it (i.e. SQL = "Select * from MyTable where Birthdate
= #" & cboBirthDate & "# ;") there's no reason for it not to return
correct data.
 
This is an okay temporary solution, but I need a permanent solution - the
combo boxes need to be pulling correct data with each search.

How can ANY automated system - or even an automated system with human
assistance - *assure* that it's pulling correct data? Names are not
unique, even in conjunction with birthdates; even SSN's aren't fully
reliable (some people don't have one, some other people have fake
ones).

The search cannot return information that is not provided - such as
the actual identity of the person.

I must be misunderstanding your question!

John W. Vinson[MVP]
 
John,

I believe that when I type in the social security number 123-45-6789 into my
combo-box and the client record that populates on the right side of the left
side of my form states that the social security number for the client is
888-77-6666 there is a problem.

If I refresh the screen and then re-type the ss# it will populate the client
record with client who has a matching ss#.


Jennifer
 
A sample of the code for one of the combo boxes (Patient ID) is as follows:
(It is the code that automatically gets created using the combo box wizard).

Private Sub Combo12_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[PATIENT_ID] = " & Str(Nz(Me![Combo12], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

Exit Sub

Any idea why I would be getting the bazaar responses?

Jennifer
 
John,

I believe that when I type in the social security number 123-45-6789 into my
combo-box and the client record that populates on the right side of the left
side of my form states that the social security number for the client is
888-77-6666 there is a problem.

Thanks for the clarification.
If I refresh the screen and then re-type the ss# it will populate the client
record with client who has a matching ss#.

Could you post the code that you're using in the combo's AfterUpdate
event? Perhaps it needs a Requery.

John W. Vinson[MVP]
 
Here is the code for one of 6 possible combos, all similar:

Private Sub Combo12_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[PATIENT_ID] = " & Str(Nz(Me![Combo12], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

Exit Sub

Any help would be appreciated!

Thanks,
Jennifer
 
Back
Top