By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,208 Members | 1,200 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,208 IT Pros & Developers. It's quick & easy.

IF...AND...THEN statements in ACCESS

P: 3
Hi everyone

i cannot figure out how to use the IF..AND...THEN statements.

i have built a report genorater form and one of the slections is to sort a specific reports by either one fo two criteria. i have built two reports and one for each criteria and i am using the code

If [Chckob] = True And [Opt_dep] = true Then
DoCmd.OpenReport "Obstacle Card Comments", acViewPreview, , obwh
End If

one being a check box and one being an option button

which i was hoping it would do but i get a debug error of "you have entered a expression with no value"

can someone please advise what i am doing wrong please
Mar 19 '07 #1
Share this Question
Share on Google+
1 Reply

P: 1,646
Hi there is no need to use the square brackets in your statement:
Expand|Select|Wrap|Line Numbers
  1. If Chckob = True And Opt_dep = true Then
  2.     DoCmd.OpenReport "Obstacle Card Comments", acViewPreview, , obwh
  3. End If
You can also write it like this:
Expand|Select|Wrap|Line Numbers
  1. If Chckob And Opt_dep Then
  2.     DoCmd.OpenReport "Obstacle Card Comments", acViewPreview, , obwh
  3. End If
Mar 19 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.