Need help with updating combo box value from another combo box in Microsoft Access using VBA

How to force the same value in another combo box from another combo box?

All please note the following sample file.
Basically after someone selects a value in ComboA - it supposed to make ComboB - appear with the same value in another table.

How do I do this with VBA code in the AfterUpdate event?

Again, I provided a sample so it would be easy to try.  Please note the two tables have similar values but different field names
Thanks in advance..

Private Sub cboA_AfterUpdate()
  
  Dim sCompany As String
  sCompany = cboA.Column(1)
  'MsgBox (cboA.Column(1))
  
End Sub

Open in new window

Database1.accdb
LVL 1
stephenlecomptejrAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gustav BrockCIOCommented:
This works for me:

Private Sub cboA_AfterUpdate()
  
    Dim sCompany As String
  
    sCompany = Me!cboA.Column(1)
    Me!cboB.Value = DLookup("ID", "[Company]", "[ItemNames] = '" & sCompany & "'")
     
End Sub

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
John TsioumprisSoftware & Systems EngineerCommented:
Would you mind giving some more info why you want such kind of duplication...the combobox was invented in order to retyping the same and same values...so select it once ...use it many.
stephenlecomptejrAuthor Commented:
Thanks for providing the answer.  I appreciate it.

No can do John but thank you for the question.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.