I want my record selecting combo box to reflect current record.

pixelpusher

New member
Local time
Today, 12:11
Joined
Dec 20, 2006
Messages
8
Can someone please help me to figure out how to make my record selecting combo box automatically select or "update" to the currently selected record?

In other words, when I select a new record using either custom "next" or "previous" record buttons, or the default "Navigation Buttons", I want my combo box (which lists and selects records) to display the newly selected record.

Thanks for any help on this!
 
I have not yet done this, but this is the approach I would use. I assume that this code should be run under the "CURRENT" event.

1. Your combobox should have at least two columns, one being the autonumber.
2. You would need to have a textbox (invisible) on your form bound to the autonumber
3. use the ListCount function to find out how many items are in your combobox.
4. Create a Do While Loop
5. Have a test in the Do While Loop to test were the autonumber in the combobox = the autonumber found in the textbox on your form.
6. Have the line: Combobox11.Selected(i)= true executed when the autonumbers match.
7. i=the current value of the do while loop, which means you will need the line i=i+1. Before entering the loop set i=0

Cavets:
1. If the autonumbers do NOT match you may need the line:Combobox11.Selected(i)= false
2. I have had minor "issues" with "Selected(i)=true". It appears to trigger the CLICK event.
 
Thanks for the reply. I'm still kind of a NOOB on Access programming, but this seems a bit convoluted.

Shouldn't there be a way to fire off a routine with the "Click" event of one of the above mentioned navigation buttons that sets the combo box selection to the record that corresponds with the now selected Current Record?

I have not yet done this, but this is the approach I would use. I assume that this code should be run under the "CURRENT" event.

1. Your combobox should have at least two columns, one being the autonumber.
2. You would need to have a textbox (invisible) on your form bound to the autonumber
3. use the ListCount function to find out how many items are in your combobox.
4. Create a Do While Loop
5. Have a test in the Do While Loop to test were the autonumber in the combobox = the autonumber found in the textbox on your form.
6. Have the line: Combobox11.Selected(i)= true executed when the autonumbers match.
7. i=the current value of the do while loop, which means you will need the line i=i+1. Before entering the loop set i=0

Cavets:
1. If the autonumbers do NOT match you may need the line:Combobox11.Selected(i)= false
2. I have had minor "issues" with "Selected(i)=true". It appears to trigger the CLICK event.
 
when I select a new record using either custom "next" or "previous" record buttons, or the default "Navigation Buttons", I want my combo box (which lists and selects records) to display the newly selected record
Doing this does not constitute good use (or even the use for which it was intended) for a combo box. But, if you absolutely have to, just set the controlsource to a field of your choice, and it will change along with your records.
 
ajetrumpet, i couldn't get it to work setting the control source in the properties of the combo box, but you're right. Maybe a list box would be better for what I'm trying to do. That way a user could see a menu of many records at a time and selecting/highlighting one would show them where they are without having to drop down a cb.


Thanks for the insight. :cool:
 

Users who are viewing this thread

Back
Top Bottom