What's wrong with the VBA?

J

John

I have a VBA as follows:



If Me.Combo71 = "A" Then

DoCmd.OpenQuery "DLRQ", acNormal, acEdit

ELSE

MsgBox "...."

Endif




Combo71="A",When I run this VBA,I can't open the query I want and there are
not any suggestive informations on the screen

Why? what's wrong with the VBA?
 
D

Danny J. Lesandrini

Maybe I'm just not getting it, but where are you saying the problem is?
Is it that the combo box evaluation is failing?

How many columns do you have in your combo box, and is the first one
actually an numeric ID field? If so, you need to write it this way ...

If Me!Combo71.Column(1) = "A" Then

Note also that I used the bang (!) instead of the dot (.)


Or are you saying that the DoCmd method is being invoked but it's not
opening the query? That could be because you're calling it wrong, but
since you use the acXXX constants, I'll assume you have that right.

However, if the query is broken, that's a whole different animal that
we couldn't diagnose based on the VBA code.
 
S

SmartbizAustralia

The other problem could be that the form is not attached to a
database.
Then when you select the value in the combo, no event fires.
Often just connecting to a simple table in the form will fix this.

Regards,
Tom Bizannes
http://www.smartbiz.com.au
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top