Update Value in ComboBox After Record Changes

Zaxxon

Registered User.
Local time
Today, 17:24
Joined
Aug 5, 2008
Messages
22
Hi, I have a combobox which I made using the third option of the combobox wizard. The user can select an ID number and it brings up the record information below.

I also have a save & next button, so when the user edits information they can click it and have the next record appear. This works fine, BUT the ID in the combobox just stays to whatever it was initially set to.

I'm worried it will be a little confusing for the user to see one ID in the combobox while the information displayed is actually from a different ID.

Any idea how to have the ID in the combobox update when a new record is brought up? I created a sample DB just show you eactly what I'm doing at the moment. Hopefully that words ok, it's saved in the 2003 compatibility mode.
 

Attachments

Jsut a line of code in the Form_Current event:

Code:
Private Sub Form_Current()
Me.YourComboBox = Me.YourIDNumber
End Sub
Replace YourComboBox and YourIDNumber with the actual names of your controls.
 
It's acting kind of strange now. I have about 800 records. When I go for instance to record 500 in the combobox, it displays the information for that record, but the combobox number show 419 instead. When I click "Save and Next" it shows 501, but shows 420 in the combobox...

Here's what I put in:
Code:
Private Sub Form_Current()
Me.CboGoTo = Me.Request_number
End Sub

Any idea?
 
Request_number is a field that contains the number/letter (i.e. 33, 34, 34b, 35) that the user is going to search by. The numbers are unique, but it's not the primary key. I have an ID autonumbering column for the PK.

I made the combobox using the wizard and picked the "Find a record on my form based on the value I selected in my combo box". The wizard gave the following properties in the After Update of the combobox:
Code:
Action: SearchForRecord
Record: First
Where Condition: ="[ID] = " & Str(Nz(Screen.ActiveControl,0))
In writing this I just figured out what the combobox is doing. When I select a request number, it brings up that record, but then the number changes to the ID number. So the combobox keeps displaying the ID number even though it's lookup is all request numbers...now how to fix it...
 
So when I use the code Me![CboGoTo] = Me![Request number], the combobox shows the [ID] number of the record instead of showing the [Request number]
 

Users who are viewing this thread

Back
Top Bottom