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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo Box AutoExpand

Status
Not open for further replies.

dusterb

IS-IT--Management
Jun 13, 2005
21
US
I have a combo box displaying a long list of possible values to select. The auto expand property is set to yes, so as you type, the selection matches, etc. My question, if the user continues to type and doesn't get a "match", winding up with a string not found in the list.... can that value be captured or accessed? I'd like to be able to pass that value as an OpenArgs to another form, presumably as a start to data entry of a new record. Any ideas?
 
Have a look at the LimitToList property and the NotInList event procedure of the ComboBox object.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I didn't think about LimitToList, thanks. Unfortunately though this combo box is bound to a hidden column (column width of 0")... bound to a Company ID but I am displaying only the Company Name, and that is what the users are typing and autoexpanding.
 
I didn't think about LimitToList, thanks. Unfortunately though this combo box is bound to a hidden column (column width of 0")... bound to a Company ID but I am displaying only the Company Name, and that is what the users are typing and autoexpanding. Anyway, because the visible column is not the bound columnt, the LimitToList cannot be set to No.
 
As PHV stated you can add item to combobox by using NotInList Event see the link (You may need to alter it to fit your purpose

________________________________________________________
Zameer Abdulla
Help to find Missing people
There’s a world of difference between editorials and advertorials
 
Thanks. I'm working with the NotInList event and I guess I'm on the right track.

My first problem is that I can't seem to "turn off" the generic Access 'Text isn't an item in the List' message. When I click 'Yes' in the dialog, the OpenArgs is passed to the second form and NewData gets populated, but before I get there, the Access error message pops up.

My second issue is that upon completing the data entry in the second form and closing it, I'm having trouble getting the combo box in the original form to requery and recognize the newly-entered company. It stays in the NotInList event.

Private Sub CompanyID_NotInList(NewData As String, Response As Integer)
strMsg = "Company '" & NewData & "' was not found " & vbCrLf & vbCrLf
strMsg = strMsg & "Do you want to add it to the Database?"

If MsgBox(strMsg, vbQuestion + vbYesNo, "Add Company?") = vbNo Then
DoCmd.CancelEvent
Response = acDataErrContinue

Else
Dim stDocName As String
stDocName = "Company"
DoCmd.OpenForm stDocName, , , , , , "Add," & NewData

End If

End Sub
 
...
DoCmd.OpenForm stDocName, , , , , acDialog, "Add," & NewData
Response = acDataErrAdded
...

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

Part and Inventory Search

Sponsor

Back
Top