Option Group and If Statement

G

Guest

I have a form called "frm_Credits". I have an option group called
"Frame_Credit". Within this group are 4 options. They populate the "Credit"
field. I also have a field called "Units". What I need to do is go through
a series of scenarios that could occur and perform an action for each one.
This is what I have for code and I put it after updating the "Units" field
and also after updating the Option Group. After updating either one of these
fields, nothing happens.

If I take out the "And Credit...", it works for the "Units" value.

I tried using a Case statement and apparently didn't get the syntax correct.

Any help would be so much appreciated.

If Units < 0 And Credit = 1 Then 'It's a credit and amount is
negative
Units = Units
ElseIf Units > 0 And Credit = 1 Then 'It's a credit and amount is
positive
Units = Units * -1
ElseIf Units < 0 And Credit = 2 Then 'It's a credit and amount is
negative
Units = Units
ElseIf Units > 0 And Credit = 2 Then 'It's a credit and amount is
positive
Units = Units * -1
ElseIf Units < 0 And Credit = 3 Then 'It's a rebill and amount is
negative
Units = Units
ElseIf Units > 0 And Credit = 3 Then 'It's a rebill and amount is
positive
Units = Units * -1
ElseIf Units < 0 And Credit = 4 Then 'It's a rebill and amount is
negative
Units = Units
ElseIf Units > 0 And Credit = 4 Then 'It's a rebill and amount is
positive
Units = Units * -1
End If

Thanks,
Rachel
 
G

Guest

Hi Rachel,

If the name of the frame is frame_credit then your and statement must be:
....And frame_credit...

eg:
If Units < 0 And frame_credit = 1 Then 'It's a credit and amount
is
negative
Units = Units
ElseIf Units > 0 And frame_credit = 1 Then 'It's a credit and amount
is

etc. etc.

HTH Paolo
 
G

Guest

Hi Paolo,

That worked. Thank you. I also had options 3 and 4 creating the sign
wrong. Oops!

Thanks a lot, this was driving me crazy.

Rachel
 

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