Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Searching a combo box

Status
Not open for further replies.

lpgagirl

Technical User
Feb 3, 2003
202
0
0
CA
I have a combo box, with a dop down list where a user chooses the name of the person they a looking for. Currently the combo box will not allow users to search for a name. I set the AutoExpand to yes and no and I still get the message,
"The control "Combo32" the macro is attempting to search can't be searched:" How can I fix? The error message also tells me some things to try but I am unsure of how to do them.

Thanks in advance,


Jeannie
 
Don't know what causing that. I would attempt to create another combobox (with the same RowSource, etc.) and see if that one works. Could be something is hosed up.
 
This is the method I used to create the combo box:

1. Create a form called frmComboTest based on the Products table, and set the form's DefaultView property to Single Form.
2. Add an unbound combo box by using the Control Wizard. (To use the Control Wizard, make sure that the Control Wizards button is pressed in on the toolbox before you create the combo box.) In the Control Wizard dialog box, follow these steps:

a. Click the Find a record on my form based on the value I selected in my combo box button, and then click Next.
b. Include the ProductID and ProductName fields, and then click Next.
c. Click Finish.
The Control Wizard creates an event procedure similar to the following:Sub ComboNN_AfterUpdate()
'Find the record that matches the control.
Me.RecordsetClone.Findfirst "[ProductID] = " & Me![ComboNN]
Me.Bookmark = Me.RecordSetClone.Bookmark
End Sub

3. View the frmComboTest form in Form view. Note that when you choose a product name in the combo box, you are moved to the record selected.


THIS IS MY ACTUAL CODE:

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

Set rs = Me.Recordset.Clone
rs.FindFirst "[ID] = " & Str(Me![Combo34])
Me.Bookmark = rs.Bookmark
End Sub

The Control Source is left blank.

I attempted to create the combo box again but I still get the error that I cannot search the field??




Jeannie
 
How are ya lpgagirl . . . . .

[blue]FancyPrairie's[/blue] targeting has hit bullseye . . . . dead center!

[blue]Don't waste your time . . . . .[/blue] [purple]delete and reconstitute the combobox.[/purple] The behavior you've described is [purple]not normal . . . .[/purple] [blue]We don't want to fix whats not normal . . . [purple]those things should work as they should![/purple][/blue]

Calvin.gif
See Ya! . . . . . .
 
Just clarify, I can scroll down the drop down list, choose a name and have the corresponding information show in the other fields. I would like to be able to put my curser in the combo box click the search button, type the name I am looking for. I would like to search both ways.

Not sure if that was clear of not?

Thanks in advance,


Jeannie
 
OK lpgagirl . . . . .

If I'm reading you right, are you saying:
TheAceMan said:
[blue]You want the additional ability to search the dropdown list while its expanded, with AutoExpand enabled, and highlight the list according to where you are in the search process . . . . .[/blue]
[purple]Is this correct?[/purple]

Calvin.gif
See Ya! . . . . . .
 
It needs to work like the other fields. When I click the search button a seperate search window appears. I type in the word I an looking for and can choose, start of, any part of field ect...the first matching record is produced.



Jeannie
 
tells me some things to try but I am unsure of how to do them.
To do what ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
lpgagirl said:
[blue] When I click the search button [purple]a seperate search window appears.[/purple][/blue]
[purple]Thats[/purple] [blue]a[/blue] [red]horse[/red] [green]of[/green] [purple]a[/purple] [green]different[/green] [blue]color![/blue]

Your talking a [blue]Custom Find Method[/blue], and considering the options your looking for, [purple]its something thats gonna take quite a bit of time, code, testing, and patience.[/purple]

Calvin.gif
See Ya! . . . . . .
 
Could you not just start typing the name you are looking for in the combo box. It should take you directly to the name you are looking for. You should not have to set up a seperate search.

Destiny Is Not The Chances We Take, But The Descisions We Make.
 
Yes, I can start typing and the name will appear. But that only works if you start typing the first word in the name. Sometimes you only know part of the name which happens to be the second or third word and therefore doesn't show. The full error message is as follows:

The control "combo34" the macro is attepting to search can't be searched:

Try one of the following:
*Add a GoToControl action before the FindRecord action.
*For the FindRecord action, change the only current field action argument fromyes to no.
*Change the focus to a searchable control.

I am unsure of how to do any of the actions that the error suggests.

Thanks for your patience with this,


Jeannie
 
Oh, I see.
It simply tell you that the combo is not bounded.
For your search in the combo issue, can you please post the value of its RowSource property ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
You may try this:
Private Sub Combo34_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[ID] = " & Str(Me![Combo34])
[blue] If rs.NoMatch Then
rs.FindFirst "[Name] Like '*" & combo34.Text & "*'"
End If[/blue]
Me.Bookmark = rs.Bookmark
End Sub

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Don't click the search button when you're in the combo.
My suggestion was to search the table with the text typed in the combo when no match was found with the ID field.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top