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

Combo Box typing updates Textboxes

Status
Not open for further replies.

redbird59

Programmer
Jan 7, 2003
6
CA
I want to create a comboBox in a form that allows the use to BOTH scroll through the items in the list, OR type in the first few letters of a name and have the form recognize the name and fill the other boxes in the form with the appropriate data for that record.

I have inherited a database I will actually create this form in and it currently has an unbelievably mottly collection of forms (four have to open in rapid succession before we get to the one to just enter or edit data) and macros and code and queries that seems unnecessary to perform what should be, in my mind, a fairly simple function. It does use a subform but that is in addition to the current functionality.

Currently the form opens with the first record from the query and allows the user to type in the text for the first name and after a few letters it automatically fills in the rest and updates all the other fields in keeping with that record. However it only works sometimes and I am charged with making it work all the time with less chaos in multiple forms and so on.

I believe I should be able to create a query that gathers the appropriate data for this form, create a form using the wizard to display that data in text boxes, convert the needed textboxes to comboboxes, and with a minimum of code make it so that when a user types a name in the combobox the combobox recognizes the name and updates all the other fields immediately. But my process is obviously flawed because I am getting nowhere.

Can anyone help? It is getting urgent!
 
If I understand correctly, you want to symchronize the combo box with the record selected in it.

I have a similar situation. In the Current event for the form itself, I have the following code, which means that when the form opens the combo box is synchronized with the record that is displayed.
Private Sub Form_Current()
Combo95 = CamperID
End Sub

Then in the combo box itself, I have the following code in the AfterUpdate event.
Private Sub Combo95_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

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

Can you use this as a template, changing the control names as necessary?

Tom

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top