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

dnt2009
dnt2009 used Ask the Experts™
on
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
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Bill RossProgrammer

Commented:
Hi,

Try adding

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

Regards,

Bill

Author

Commented:
Hi Bill,

I'm new to Acces so I need more details ;-) Where do I add this?
Bill RossProgrammer

Commented:
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
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

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

Commented:
Hi,

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

What exactly are you trying to do?

Thanks,

Bill

Author

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
Programmer
Commented:
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
Bill RossProgrammer

Commented:
OK.  That makes sense and see updated sample.  This does not require any code.

Bill

Author

Commented:
Great. Thanks Bill!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial