473,405 Members | 2,185 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,405 software developers and data experts.

Creating an IF/AND statement

This is probably very easy but I'm not experienced with writing code.
Here's what I'm trying to do:

I want to print a report that has text "Unapproved Document" at the top
if two conditions are met:
1. PriceIncrease field is checked (true)
2. Approval field is Null

If the conditions are not met, then the words "Unapproved Document"
will not appear in the report.

The report pulls these fields from a query called OAQuery. I created
an unbound text field in the report named "ApproveWarning" that will
act as a container to put the words "Unapproved Document".

Here's my code, which is getting a runtime error:

Private Sub Report_Open(Cancel As Integer)

If OAQuery.PriceIncrease = True Then
If OAQuery.Approvel = Null Then
Me!ApproveWarning = "UNAPPROVED DOCUMENT"
Else
Me!ApproveWarning = Null
End If
End If
End Sub

What am I doing wrong??

Nov 30 '06 #1
2 1589
try
If OAQuery.Approvel = Null Then
If IsNull(OAQuery.Approvel) Then
"Swinky" <sw********@lunt.comwrote in message
news:11**********************@l12g2000cwl.googlegr oups.com...
This is probably very easy but I'm not experienced with writing code.
Here's what I'm trying to do:

I want to print a report that has text "Unapproved Document" at the top
if two conditions are met:
1. PriceIncrease field is checked (true)
2. Approval field is Null

If the conditions are not met, then the words "Unapproved Document"
will not appear in the report.

The report pulls these fields from a query called OAQuery. I created
an unbound text field in the report named "ApproveWarning" that will
act as a container to put the words "Unapproved Document".

Here's my code, which is getting a runtime error:

Private Sub Report_Open(Cancel As Integer)

If OAQuery.PriceIncrease = True Then
If OAQuery.Approvel = Null Then
Me!ApproveWarning = "UNAPPROVED DOCUMENT"
Else
Me!ApproveWarning = Null
End If
End If
End Sub

What am I doing wrong??


Nov 30 '06 #2
Just a guess: Are the Fields "Approve1" and "ApproveWarning" in the Record
Source for the Report, but not displayed directly in Controls on the Report?
Access' Reporting "helps us out" by not having available those fields in the
Record Source that aren't displayed in Controls on the Report -- to make our
processing more efficient. If you don't have those on the Report, create
Text Boxes for them, but set their Visible property to No, and then try
again.

Larry Linson
Microsoft Access MVP
"Swinky" <sw********@lunt.comwrote in message
news:11**********************@l12g2000cwl.googlegr oups.com...
This is probably very easy but I'm not experienced with writing code.
Here's what I'm trying to do:

I want to print a report that has text "Unapproved Document" at the top
if two conditions are met:
1. PriceIncrease field is checked (true)
2. Approval field is Null

If the conditions are not met, then the words "Unapproved Document"
will not appear in the report.

The report pulls these fields from a query called OAQuery. I created
an unbound text field in the report named "ApproveWarning" that will
act as a container to put the words "Unapproved Document".

Here's my code, which is getting a runtime error:

Private Sub Report_Open(Cancel As Integer)

If OAQuery.PriceIncrease = True Then
If OAQuery.Approvel = Null Then
Me!ApproveWarning = "UNAPPROVED DOCUMENT"
Else
Me!ApproveWarning = Null
End If
End If
End Sub

What am I doing wrong??

Dec 1 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Dan | last post by:
Hi I tried the following from the help file... When you create or modify a unique index, you can set an option to ignore duplicate keys. If this option is set and you attempt to create...
11
by: randi_clausen | last post by:
Using SQL against a DB2 table the 'with' key word is used to dynamically create a temporary table with an SQL statement that is retained for the duration of that SQL statement. What is the...
3
by: ross.oneill | last post by:
Hi I want to create a temp table called DECLARE LOCAL TEMPORARY TABLE tempdate(test integer) in VDATE; but I always get an error. I read that I have to create a Table space so I did. Any...
21
by: Sharon | last post by:
I wish to build a framework for our developers that will include a singleton pattern. But it can not be a base class because it has a private constructor and therefore can be inherit. I thought...
8
by: Simon Edwards | last post by:
Something thats been bugging me for a while... how do you create a namespace that has many children (namespaces) I.e system.io.blah.blah Iv'e done it by creating a class which contains...
16
by: pukivruki | last post by:
hi, I wish to create a temporary table who's name is dynamic based on the argument. ALTER PROCEDURE . @PID1 VARCHAR(50), @PID2 VARCHAR(50), @TICKET VARCHAR(20)
2
by: ddddd | last post by:
CREATE PROCEDURE PART6(IN a FLOAT, IN b FLOAT, OUT retval FLOAT) BEGIN retval = a * b END The above procedure creation statement throws error saying DB21034E The command was processed as...
13
by: jkimbler | last post by:
As part of our QA of hardware and firmware for the company I work for, we need to automate some testing of devices and firmware. Since not everybody here knows C#, I'm looking to create a new...
2
by: kya2 | last post by:
I am not able to create following store procedure. CREATE PROCEDURE DBSAMBA.InsertDeleteBatch(OUT norows INT ) RESULT SETS 1 LANGUAGE SQL BEGIN part1 DECLARE TOTAL_LEFT INT DEFAULT 0; ...
1
by: wbrands2 | last post by:
I have a basic web form that inserts information into a ms sql database and I am trying to create a search page for it. I am running into the problem that after I insert the information into the web...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.