Full Version: Creating a dropdown list that auotpoulates other fields
UtterAccess Forums > Microsoft® Access > Access Forms
dabliss74
ok, so I have a columnar form called Group info and I want to create a drop-down list with all of the company names in the field 'comany name' which autopopulates the corresponding fields with the correct address, phone, etc...can someone help?...it will either drop down nothing, the field names of the query, number ID's, or ALL one company name depending on how I change the control source
fkegley
Assuming Group info form is bound to its table, the simplest way to do this is to use a Find a record on my form blah blah blah combo box. The Control Wizard can do this for you.
dabliss74
ok this is gonna sound dumb...but...... control wizard?
Jack Cowley
It appears that Mr. Kegley has let the building so I will step in and hope I don't inadvertently step on his toes...
The Toolbox toolbar has a 'magic wand' as one of its Icons. Be sure this Icon is 'pressed in' as that it the Wizard that Frank was talking about. With the icon selected you can drag the combo box from the Toolbox to you form and the Wizard will start. If you add the combo box to a form based on your table and you select the 3rd item on the Wizards first screen ("Find a record...") this combo box, when finished, will show the details of the record on you from that was selected in the combo box. If, for example, you select Company R then the your main form will move to that record and display its data.
hth,
Jack
dabliss74
ok...I hat a regular text field and then i cheged it to a combo box...do i need to delete that fiel and start fresh?
Jack Cowley
Yes, you need to delete the current combo box.
et me assume you have a form based on a table of customers. This form shows all the fields from the table and what you want to do is display the record for Joe Bloggs. What you want to do is add a combo box to this form using the Wizard. On the Wizards first screen select the 3rd item, "Find a record....". Finish the Wizard. Now in your combo box you can scroll to find Joe Bloggs or you can start to type in his name. When you find Joe Bloggs his record will be shown on the form.
Jack
dabliss74
Awesome man...that was alot simpler than I was making it...thanks for youre help
ECCEnergy
I was reading this and It was just the info I was looking for.
It Works.
Thanks
Jack Cowley
I'm glad you found this thread helpful.
ack
Jack Cowley
You are welcome and glad to hear that you are back on track...
ack
dabliss74
I do have one poser...if someone wants to manually scroll through the records, the rest of the records chang, but the group name stays the same....can I have my caKe and eat it too?
Jack Cowley
In the On Current event of the form:
e.NameOfComboBox = Me.NameOfControlWithGroupID
I will assume the combo box bound column is the GroupID and this is what you use to search your form with.
hth,
Jack
fkegley
Thanks, Jack, for jumping in. I had indeed left the building. My toes are just fine, too!
Edited by: fkegley on Tue Jan 10 9:38:33 EST 2006.
dabliss74
this is what it looks like:
Option Compare Database
Private Sub Group_Name_Click()
End Sub
Private Sub Combo51_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[ID] = " & Str(Me![Combo51])
Me.Bookmark = rs.Bookmark
End Sub
Private Sub Combo53_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[ID] = " & Str(Me![Combo53])
Me.Bookmark = rs.Bookmark
End Sub
Jack Cowley
Is there a question there or are you just letting others know what code you used?
ack
PS. I am gone until 2pm today Pacific Time
dabliss74
no, my question is ...how do i make it so it manually scrolls though the group names(now that the dropdown list works, the mannual scroll at the bottom of the window and the mouse scrolling goes through the other companies infortmation, but the 'group name' field doesnt change...or can I not have it both ways...I appreciate your patience thanks frown.gif
Jack Cowley
In the On Current event of the form:
e.Combo51 = Me.NameOfControlOnFormWithID
Me.Combo53 = Me.NameOfControlOnFormWithID
That should do the trick. Change NameOfControlOnFormWithID to the actual name of your control that has the ID in it.
I'm outta here...
Jack
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.