473,382 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

If Statement Against a Check Box

6
I'm trying to get the following If statement to work in a report:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Report_Open(Cancel As Integer)
  2. If Me![ChkPerm] = 0 Then
  3.     Me![txtBOX].BorderColor = 16711680
  4. Else
  5.     Me![txtBOX.BorderColor = 10711680
  6. End If
  7. End Sub
I can't get a valid "If" statement. I keep getting "You entered an expression that has no value."

What is the proper way to check an "if" statement against a check box?

Thanks,

Mike
Aug 30 '06 #1
9 7115
mmaki
6
Note, I have also tried many variations of
If Me![ChkPerm] = Yes Then
If Me![ChkPerm] = On Then
If Me![ChkPerm] = True Then
Aug 30 '06 #2
MMcCarthy
14,534 Expert Mod 8TB
Try the following:

Note if after you type Me. the field you want doesn't appear on the list that drops down then the field is missing from your report.

Private Sub Report_Open(Cancel As Integer)
If Me.ChkPerm = 0 Then
Me.txtBOX.BorderColor = 16711680
Else
Me.txtBOX.BorderColor = 10711680
End If
End Sub

Note, I have also tried many variations of
If Me![ChkPerm] = Yes Then
If Me![ChkPerm] = On Then
If Me![ChkPerm] = True Then
Aug 30 '06 #3
mmaki
6
Just tried that with same result, "You entered an expression that has no value."

ChkPerm does appear on the list that drops down. Arghhhh
Aug 30 '06 #4
MMcCarthy
14,534 Expert Mod 8TB
Go into the report design mode and look at the field that you thought was ChkPerm. Does it exist and if so what is it named. If it is not on the report and you don't want it visible on the report than open the field list and drag it onto the report. Delete the label and make the textbox visible property to No.

Just tried that with same result, "You entered an expression that has no value."

ChkPerm does appear on the list that drops down. Arghhhh
Aug 30 '06 #5
mmaki
6
ChkPerm exists and it is on the form. It is named ChkPerm. I made it invisible. Makes no difference....Thanks for the suggestions though. I appreciate it.
Aug 30 '06 #6
MMcCarthy
14,534 Expert Mod 8TB
In the table containing ChkPerm have you made the default value = 0?

ChkPerm exists and it is on the form. It is named ChkPerm. I made it invisible. Makes no difference....Thanks for the suggestions though. I appreciate it.
Aug 30 '06 #7
mmaki
6
Here is what I am finding out. If I place the code in another procedure like "activate" I don't get the error, but it does me no good there. It has something to do with the "open" procedure. And it's the only procedure that will do what I need.

I made the default value = 0 and still same error.
Aug 30 '06 #8
mmaki
6
Fixed it. Needed to place code in. Section Detail...Event...On Format

mccarthy thanks for the help!
Aug 30 '06 #9
Thanks for the solution - I thought I was the only VBA newbie on the internet with exactly that problem.
Sep 28 '10 #10

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

Similar topics

5
by: Toby Donaldson | last post by:
Hi all, I'm designing an educational application that will run Python code and check the output against a pre-define answer. I want to use the "exec" statement to run the code, but I don't know...
5
by: Steve | last post by:
Hello, I've been a PHP programmer for a number of years and have just started to learn JS. My Employer (a water analysis lab) wants what should be a very simple .js written that basically takes...
10
by: Philip Sherman | last post by:
SELECT columns FROM t1 JOIN t2
6
by: Terentius Neo | last post by:
Is it possible to combine (in DB2 UDB 8.1) a stored procedure and a select statement? I mean something like this: Select c.number, call procedure( c.number ) as list from table c With best...
7
by: mark | last post by:
Access 2000: I creating a report that has a record source built by the user who selects the WHERE values. An example is: SELECT * FROM CHARGELOG WHERE STDATE Between #10/27/2003# And...
1
by: Berko | last post by:
I'm having problems with a switch statement that is wrapped in a foreach statement so that each index in an array is evaluated against the switch statement. The switch/case will then return some...
13
by: eman1000 | last post by:
I was recently looking at the prototype library (http://prototype.conio.net/) and I noticed the author used the following syntax: Object.extend(MyObj.prototype, { my_meth1: function(){},...
5
by: mark4asp | last post by:
Every time the function below is called I get the alert. So I put a deliberate error in there and I check the value of (reportType=='MANDATE') in Firebug, which is found to be true. But still the...
13
by: Satya | last post by:
Hi everyone, This is the first time iam posting excuse me if iam making any mistake. My question is iam using a switch case statement in which i have around 100 case statements to compare. so...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.