Combo box and Form update

2077delta

Active Member
Joined
Feb 17, 2002
Messages
252
Office Version
  1. 365
Platform
  1. Windows
I have a form based on a query that returns a product id and related info on the product. The form contains a combo box to allow the user to select the product id. This part works fine so when I select a different product id all the other information on the for changes accordingly. However, when I use the navigation buttons to cycle through the products, the text boxes change but the combo box doesn't show the product id for the new record. I know this can be done because the Orders form in the Northwind database works this way. However I can't seem to get my form to function the same way. How do I get the combo box to update to the product id for the new record when I use the navigation buttons?
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Assuming you meant "other record" with "new record" by using navigation buttons.

Goto Form_Current sub and put the following code:

Code:
Private Sub Form_Current()
  cmbProductID.Value = Me.ProductID.Value
End Sub

Suat
 
Upvote 0
You need to set the control source for your combo box to the appropriate field in the underlying query

HTh

Peter
 
Upvote 0
Thanks for the help guys. I already had the ProductID selected from the current query. I tried inserting the code as suggested, but when I open the form, I receive an error message. The message says "Run time error 424. Object required." I thought the ProductID reference was the object. Also, I keep seeing references to "Me.(whatever)". How is this reference used? You must pardon my ignorance, but I'm new to this and I can't find any references to this nomenclature. Is there some parameter I have to set for this to work?

Thanks for all the help.
 
Upvote 0

Forum statistics

Threads
1,221,558
Messages
6,160,484
Members
451,651
Latest member
Penapensil

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top