View Full Version : Macro print IF statement problem


voidcranium
06-11-2010, 06:29 AM
Hello all, I have a question/problem and I need your expert advice/wisdom.

I have a program that prints out Work Orders. The original person who set all this up made a MACRO to do this. (See image)

I need this print command to access an if statement and IF TRUE I need it to print another report.

I don't know how to get an IF statement in the Original MACRO.

Got any ideas?

Thanks


http://i87.photobucket.com/albums/k155/iglooiguana/Database/printmacro.jpg

pbaldy
06-11-2010, 07:32 AM
If you want to stay with macros, you can click on View/Conditions which will give you an extra column, where you can add the test. Or you can use this as the opportunity to switch to VBA and use an If/Then block.

voidcranium
06-11-2010, 11:06 AM
If you want to stay with macros, you can click on View/Conditions which will give you an extra column, where you can add the test. Or you can use this as the opportunity to switch to VBA and use an If/Then block.

I am going to have to try the VBA part because I am getting nowhere with the macro thing.

I would rather do it with VBA but this print macro is set up different than my other print buttons.

This part is what I am not sure what to do about.
[Forms]![frmInitiateWorkOrder]![Id]=[tblMainTable]![Id]
This is what the macro is using.

I tried just creating a new print button but it started printing all the records in the database.

pbaldy
06-11-2010, 11:28 AM
Sounds like you want this:

http://www.baldyweb.com/wherecondition.htm

voidcranium
06-15-2010, 05:05 AM
Sounds like you want this:

http://www.baldyweb.com/wherecondition.htm

Thanks,

I will try this out later today or tomorrow.

voidcranium
06-16-2010, 10:27 AM
I just happened to get the macro thing to work.

I was trying to do to much with the condition statement.

Here is what I ended up doing.

Under the Condition column I just used this:
cboFlexo=True

I was trying to make an IF THEN statement but all I had to do is enter that code. This is the first time I have ever tried to make changes to a macro so I have learned something new.


Thanks for your help.

voidcranium
06-16-2010, 10:29 AM
Sounds like you want this:

http://www.baldyweb.com/wherecondition.htm

I have your site bookmarked. Some nice information on there.

Thanks!

pbaldy
06-16-2010, 10:34 AM
Happy to help, and thanks for the compliment. I'm trying to create a useful site.

boblarson
06-16-2010, 10:55 AM
I'm trying to create a useful site.

It is working - I send folk there quite a bit. :)

vbaInet
06-16-2010, 03:56 PM
It is working - I send folk there quite a bit. :)I do too :)