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

How can I go to another record in a form by using combo box

P: 1
I have a form with a combo box that I want to use for navigating through the records. I have 10 records (for test purposes) in my table (mainly text boxes, but also a check box and an ole object for pictures). When navigating through the records by using page down or the default record navigator everything in the form change according to what I have entered into the table (Table_Person).

Instead I want to use a combo box to navigate the records. First names (Col_First_Name) are displayed in the combo box. I don't allow first name dublicates even though the primary key is the Col_ID.

So what I am trying to accomplish here is to go to the record associated with the first name that I choose in the combo box. Of course everything else in the form must change as well (txt boxes, check boxes, images etc.)

How can I achieve this?
Mar 14 '07 #1
Share this Question
Share on Google+
2 Replies


dima69
Expert 100+
P: 181
I have a form with a combo box that I want to use for navigating through the records. I have 10 records (for test purposes) in my table (mainly text boxes, but also a check box and an ole object for pictures). When navigating through the records by using page down or the default record navigator everything in the form change according to what I have entered into the table (Table_Person).

Instead I want to use a combo box to navigate the records. First names (Col_First_Name) are displayed in the combo box. I don't allow first name dublicates even though the primary key is the Col_ID.

So what I am trying to accomplish here is to go to the record associated with the first name that I choose in the combo box. Of course everything else in the form must change as well (txt boxes, check boxes, images etc.)

How can I achieve this?
Something like this :

Expand|Select|Wrap|Line Numbers
  1. Private Sub MyCombo_AfterUpdate()
  2. Dim rs As Recordset
  3. If Me![Col_ID] <> Me![MyCombo] Then
  4.     Set rs = Me.RecordsetClone
  5.     rs.FindFirst "Col_ID = " & Me![MyCombo]
  6.     If Not rs.NoMatch Then
  7.         Me.Bookmark = rs.Bookmark
  8.     End If
  9. End If
  10. End Sub
Mar 17 '07 #2

missinglinq
Expert 2.5K+
P: 3,532
Or if VBA code seems intimidating to you, let Access do the work and simply use the combo box wizard. Place a combo box on the form, and when the wizard comes up select the third option "Find a record on my form based on the value I selected in my combo box."

Click Next, then under Available Fields select Col_First_Name
Mar 17 '07 #3

Post your reply

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