L
Linda RQ
Hi Everyone,
I'll explain the best I can but I know there is more to this problem than I
have figured out so I may need some leading questions to help me explain.
Really new and clueless to VB. I have a lookup combo box on a form. The
user can look for active or inactive patients depending on what form they
are on and if the patient is in the list, they can select that name and the
form will go to that patient's record. Before this line
rs.FindFirst "[PtID] = " & Me.Combo78
was this
rs.FindFirst "[PtLName] = " & Me.Combo78
The problem with the first one was duplicate names. If I have 2 Smith's,
and select the 1st or 2nd one, the record would always go only to the first
Smith. As time goes by, this gets worse because now I have 20 Smith's. I
thought I figured it out and changed my combo box to find PtID instead of
Last Name. Now it will go to which ever Smith I select but if the user
types in Zeek to look for Zeek I get an error to debug this rs. line. I
think it's because the bound column is set to 4 (which is PtID) and my first
column is last name which is what the combo box reveals. I looked in the
data tab of the properties for my combo box and tried to change "Limit to
List" to no but it wouldn't let me because the first visible column, which
is determined by the ColumnWidths property isn't equal to the bound column.
Adjust the ColumnWidths property first, then set limit to list property.
Here is my ColumnWidths property....1";1";1";0" Column 1 is LName, Column 2
is FName, Column 3 is Room number and Column 4 is PtID.
Here is the current code which is opened up to debug if the user leaves the
combo box blank after searching.
Private Sub Combo78_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[PtID] = " & Me.Combo78
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
Hopefully someone can decipher my code <g> and help.
Thanks,
Linda
I'll explain the best I can but I know there is more to this problem than I
have figured out so I may need some leading questions to help me explain.
Really new and clueless to VB. I have a lookup combo box on a form. The
user can look for active or inactive patients depending on what form they
are on and if the patient is in the list, they can select that name and the
form will go to that patient's record. Before this line
rs.FindFirst "[PtID] = " & Me.Combo78
was this
rs.FindFirst "[PtLName] = " & Me.Combo78
The problem with the first one was duplicate names. If I have 2 Smith's,
and select the 1st or 2nd one, the record would always go only to the first
Smith. As time goes by, this gets worse because now I have 20 Smith's. I
thought I figured it out and changed my combo box to find PtID instead of
Last Name. Now it will go to which ever Smith I select but if the user
types in Zeek to look for Zeek I get an error to debug this rs. line. I
think it's because the bound column is set to 4 (which is PtID) and my first
column is last name which is what the combo box reveals. I looked in the
data tab of the properties for my combo box and tried to change "Limit to
List" to no but it wouldn't let me because the first visible column, which
is determined by the ColumnWidths property isn't equal to the bound column.
Adjust the ColumnWidths property first, then set limit to list property.
Here is my ColumnWidths property....1";1";1";0" Column 1 is LName, Column 2
is FName, Column 3 is Room number and Column 4 is PtID.
Here is the current code which is opened up to debug if the user leaves the
combo box blank after searching.
Private Sub Combo78_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[PtID] = " & Me.Combo78
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
Hopefully someone can decipher my code <g> and help.
Thanks,
Linda