Access field to be filled out based on input from linked comboboxes

Hi,

Please find attahced my database sample file.

In the instruction form (based on the Instruction query), I would like for the holder combobox to show only holders for the specific account. I have used an event procedure after update on the account combobox. The problem is that sometimes it works sometime it doesn't.

The instuction table table required AccountHolderID to be populated. I would like to polulate this field based on the selection of both account and holder comboboxes. I'm not sure how to do this. Use a query? a Macro?

Your help would be greatly appreciated.

Thanks,
dnt
Sample-File.mdb
dnt2009Asked:
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.

Bill RossProgrammerCommented:
Hi,

Try adding

Me!HolderNumber.Recordsource...
Me!HolderNumber.Requery

Regards,

Bill
dnt2009Author Commented:
Hi Bill,

I'm new to Acces so I need more details ;-) Where do I add this?
Bill RossProgrammerCommented:
Hi,

In the AfterUpdate event of the account combo box.  Below the line where you set the recordsource.

....

Me!HolderNumber.Recordsource...  <-your existing code (no change required)
Me!HolderNumber.Requery  <-new code

...

Regards,

Bill
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

dnt2009Author Commented:
Hi Bill. Fixed my first issue. Thanks.
Can you help me with the lookup issue I have described above?
Bill RossProgrammerCommented:
Hi,

Looking at your relationships in the database this would not be correct.

What exactly are you trying to do?

Thanks,

Bill
dnt2009Author Commented:
I'm trying to populate the Instruction table with instructions coming from clients. So the employee fill in the Instruction form with the clients 'instructions : online or Offline.
Given the many-to-many relationship between clients and accounts, I have created a joint table: which holds details of the accounts and holders. This table is then linked to the Instruction table.
However, when I input instrcution, an additional row is created in the joint table. Nothing should be created in the joint table only in the instruction table.
So I though to automaticaly populate the joint function primary key once an instruction is saved. As account and holder would have been selected, I can look up in tblAccountsHolders to populate the AccountHolderID in the instruction table.
Hope this makes sense.

thanks,
dnt
Bill RossProgrammerCommented:
Hi,

Looking at the DB design more it seems to me you want to look up the AccountHolderID from tblAccountHolders and populate tblInstructions from that.

If that's what you're trying to do then you do not need code to do that.

See attached revised sample.

PS.  You should also Compact your db before you upload it.  Saves a ton of space.

Bill
Sample-FileRevised.mdb

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
Bill RossProgrammerCommented:
OK.  That makes sense and see updated sample.  This does not require any code.

Bill
dnt2009Author Commented:
Great. Thanks Bill!
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 Office

From novice to tech pro — start learning today.