Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code help 1

Status
Not open for further replies.

cbearden

Technical User
May 17, 2004
80
US
I have a 2 categories, G and SC.
Each of these categories has Cost, Refund, and Rec textboxes. I'm trying to get a checkbox(chkAllRec) to automatically be checked when the G-Refund, G-Rec and SC-Refund, SC-Rec is typed in. DOn't know if this part matters, but...I also have where if the G-cost or SC-cost = 0, the Refund and Rec fields of all categories are disabled.

I am having trouble on how to do the multiple conditions.

Thanks in advance for the help!
 
I am having trouble on how to do the multiple conditions
What have you tried so far ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I'm not good at coding. So don't laugh.

I started to do...

If Me!Grefund.enabled = True And Nz(Me!refund, 0) <> 0


I would need it like that but for 3 other categories. How would I put another condition in? A comma? I need the other 3 categories like [Category G]. It won't allow me to go to the next line. An error comes up.

I know i'm probably doing this all wrong.

Please help. :(
 
Something like this ?
If Me!Grefund.enabled = True And Nz(Me!Grefund, 0) <> 0 _
And Me!SCrefund.enabled = True And Nz(Me!SCrefund, 0) <> 0 Then
...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Honestly...that's what I was thinking(minus the underscore)...but I thought that it would be too many And's and it wouldn't be able to distinguish between the categories (Grefund/Grec and SCrefund/SCrec).

what is the underscore for?

Thanks!
 
what is the underscore for?
It's the continuation line character.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I'm coming across a problem. Some of the time one of the categories will be disabled. And with the code I put in, the checkbox won't be checked, unless all 4 of those boxes have values.

Is there a way that it could select those that the .enabled = True and is Not Null?

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top