By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,395 Members | 2,505 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,395 IT Pros & Developers. It's quick & easy.

After Update Run Macro

P: n/a
Hi,

I am struggling to learn access and VBA whilst creating a db, progress
is slow!
So far I have managed to run cascading combo boxes on a form by using a
sub in the after update procedure of the 1st combo box to populate the
second, using code like below.

Select Case combo1.value
Case "1"
Combo2.Rowsource = "bla"

And this has worked because in that situation there was a limited
number of choices in combo1.
However I now need to populate a combo box where there are a massive
amount of choices in combo1, so I cannot use the method above without
creating loads of tables.

The idea is to select an outer postcode (eg. IP1, IP23 etc) from
combo1, and combo2 will populate with all the customers in that
postcode area.

I have tried the below but this may be totally the wrong method, and
even if it is the right way to do it I can't get it to work.

I created a query showing the customer details and the outer postcode.
In the Outer postcode criteria i put
[Forms]![AllCustomers]![Combo1]
(Eg it will show all accounts where the Outer Postcode matched what is
enetered in the 1st combo box on the form).

I set the row source of combo 2 to be this query.

Then I created a macro to ReQuery this Query.

Then in the after update of the 1st combo box I want to run the macro I
have created. This is the part I can't do.

Any suggestions as to whether I am going about this the correct way
would be appreciated, and also how to run this macro from the after
update of my 1st combo. I tried the RunMacro in a sub in VBA but i
think I must be getting the arguments wrong.

Thanks everybody.

Dec 4 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a

I have now worked out the DoCmd.RunMacro to run the macro as described
above however the 2nd combo box isn't populating with the query
results.

If i run the query on it's own I am prompted to "Enter Parameter Value"
and f I enter an outer postcode the query run's perfectly.

What am I doing wrong?

Dec 4 '06 #2

P: n/a

Sorry for continually updating this post. I am euphoric asI have now
got the 2nd combo box to show the customer details working!

However I cannot select from the combo box. I want to populate fields
on the form with these details but the list just drops down and I
cannot make a selection. Please tell me how stupid I am being and where
I am going wrong!

Dec 4 '06 #3

P: n/a
Make sure that in your form properties you have "Allow Edits" enabled.

Cheers,
Jason Lepack

keri wrote:
Sorry for continually updating this post. I am euphoric asI have now
got the 2nd combo box to show the customer details working!

However I cannot select from the combo box. I want to populate fields
on the form with these details but the list just drops down and I
cannot make a selection. Please tell me how stupid I am being and where
I am going wrong!
Dec 4 '06 #4

P: n/a

"Allow Edits" is set to Yes! What else can i try?

Dec 4 '06 #5

P: n/a

I really need to try harder before I start posting!

Finally I have worked it out - I had put the query in control source
(as well as row source) by accident!

Thanks for all the help anyway.

Dec 4 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.