VBA to Populate Combo Box

samjh

Registered User.
Local time
Today, 20:54
Joined
Jan 10, 2013
Messages
64
Hi,

I hope this is the correct Forum!

I have a Commitment Form and one of the combo boxes the user is to fill in is ExpSubjective.

There is a button on this form which then opens the Income Form, (currently it pulls the commitment ID over which is fine) and the user has to select the IncSubjective from a list within the IncSubjective Combo Box (within the properties of this combo box, there is a query that limits the available income subjectives based on what the expenditure subjective was in the previous form).

What i would like is to have the Income Subjective automatically populated in the form when I open the Income Form rather than the user having to select it from a drop down list.

My tables are set up as follows:
Expenditure Subjective
ExpSubjective (1)
Expenditure Description

Income Subjective Table
IncSubjective
IncSubjectiveDescription
ExpSubjective (to Many)

The issue is A) I don't know how to write this in VBA and B) there will always be the possibility of there being two income subjectives to every expenditure subjective, the second will always be a specific code say 92243 (although I always with it to select the other code not 92243).

Can anyone help please.
 
You can use the OpenArgs portion of the OpenForm method to pass information between the calling form and the form being called. This can then be tested in the On Load event of the form being called.

Have a look at the attached sample for an example of how you might use this.
 

Attachments

Hi,

Thanks for your response.

Unforntuately I can't get the attached database to open.

I also don't understand what to do here sorry. I've managed to pick up most things I've asked about tbut this one has confused me I'm afraid.

Also as an update, there would now only ever be one income commitment that would be available. I donlt know if that would make the how to get this to appear in the box be done through a different method.
 
What version of Access are you using? I'll convert it latter in the day when I'm back on a machine with Access '10.
 

Users who are viewing this thread

Back
Top Bottom