If statement

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have two values, one numeric, one text from a combo box. I would like to
populate another field based on these values. I need an If statement that
goes something like:

If A and B, then Z, If A and C, then Y, If D and B, then W, If D and C, then
X....

Can I put this in the default value box for this field? Do I have to write
a macro or use Visual code to perform this task?

Thanks!
 
Try using a Case statement. Something like this:

Dim strValue as String

strValue = [Field1] & "-" & [Field2]

Select Case strValue
Case A-B
<Action statement>
Case A-C
<Action statement>
Case D-B
<Action statement>
Case D-C
<Action statement>
End Select

You can add as many Case statements, as necessary. Then just put your code
after each statement.

Sharkbyte
 

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

Similar Threads


Back
Top