By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,636 Members | 1,915 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,636 IT Pros & Developers. It's quick & easy.

Combo Box Populating Multiple Text Boxes

P: 5
Hi everyone. I need help. I have a combo box in my form that i want to populate multiple text boxes after you select your selection in the combo box. Here is my set up.

The Fields that need to be populated are lsited below but must be recorded to a new table. Gets info from Course occurance Table.

Combo Box - Gets Information from Course Occurance Table. This table has all information regarding course information.

Course ID:
Course Name:
Hours:
End Date:

So after the selection is made from combo box. It populates these fields. Combo box gets info from course occurance table. The fields on the form are linked to the grades table on my data base. I want the info pulled from course occurance table then populate it in these fields . Which will then be recorded to the Grades Table. I have the combo box working just i cant figure out how to populate the fields. Please Help.

Sincerely,
Ray Z
Jul 10 '07 #1
Share this Question
Share on Google+
6 Replies


P: 5
Im using Access 2007. Please Help!
Jul 10 '07 #2

puppydogbuddy
Expert 100+
P: 1,923
Im using Access 2007. Please Help!
If I understood correctly, you would use the AfterUpdate event of your combo to update the textboxes as shown below. Replace the generic names I used for your textboxes and your combo box with the actual names used in your application.
Expand|Select|Wrap|Line Numbers
  1. Private Sub YourCombo_AfterUpdate
  2.  
  3. If Not IsNull(Me!YourCombo) Then
  4.      Me!txtCourseID.Value  = Me!YourCombo.Column(0)
  5.      Me!txtCourseName.Value = Me!YourCombo.Column(1)
  6.      Me!txtCourseHours.Value = Me!YourCombo.Column(2)
  7.      Me!txtEndDate.Value = Me!YourCombo.Column(3)
  8.      Me.Requery
  9. End If
  10. End Sub
  11.  
Jul 10 '07 #3

P: 5
Thanks. You are the Best. I appreciate it.
Jul 10 '07 #4

P: 4
Thanks. You are the Best. I appreciate it.
By the way, I am having the same problem. My combo box has two fields from an underlying query called MMS and Rev. I want to requery the form based on these two values and only know how to do this for one value. My combo box has a name of Combo14 and I don't know how to refer to the values separately if you know what I mean. My code looks like this and worked when I just queried based on the MMS. When I decided I needed to query based on both MMS and Rev I got lost.

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

Set rs = Me.Recordset.Clone
rs.FindFirst "[MMSCode] = '" & Me![Combo14] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Help. By the way, how do I get the answer to this question. I tried posting a question before and still have not figured out how to go see if someone answered it.

Thanks so much,
DeeDee
Jul 18 '07 #5

puppydogbuddy
Expert 100+
P: 1,923
By the way, I am having the same problem. My combo box has two fields from an underlying query called MMS and Rev. I want to requery the form based on these two values and only know how to do this for one value. My combo box has a name of Combo14 and I don't know how to refer to the values separately if you know what I mean. My code looks like this and worked when I just queried based on the MMS. When I decided I needed to query based on both MMS and Rev I got lost.

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

Set rs = Me.Recordset.Clone
rs.FindFirst "[MMSCode] = '" & Me![Combo14] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Help. By the way, how do I get the answer to this question. I tried posting a question before and still have not figured out how to go see if someone answered it.

Thanks so much,
DeeDee
DeeDee,
If you click the hyperlink to your profile in upper left, you will see links to all your previous posts and threads. In regard to the problem with your combo, I need a little more info..............see below:
1. what are MMS and Rev ? what is the primary key to your table(s) that have MMS and Rev in them.
2. show me a one line sample of what the data looks like.
Jul 18 '07 #6

P: 4
Thanks so much for your time. I just figured out how to get to the answers to my posts!!! Ha Ha.
I did get the answer to this problem. You use the .column() subscript to refer to each element in the combo box.

Now I can look for answers to my posts. I appreciate your help.
I'm new so forgive me.
DeeDee


DeeDee,
If you click the hyperlink to your profile in upper left, you will see links to all your previous posts and threads. In regard to the problem with your combo, I need a little more info..............see below:
1. what are MMS and Rev ? what is the primary key to your table(s) that have MMS and Rev in them.
2. show me a one line sample of what the data looks like.
Jul 27 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.