473,382 Members | 1,424 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.

Why won't this work in my report?!

147 100+
I have a report called rptCarSheet that is grouped on a field called ShiftID. In the ShiftID Group I have several fields that I am trying to input data by the following expression:

[exp] =IIf([AreaID]="1",[Employee]) [exp]

for each field I have changed the AreaID value the the value I need "2" "3" etc.

My problem is that it only works for the first instance entered. I have tried it in the details section as well and get the same issue.

Please tell me what I am doing wrong
Thanks
Dan
Feb 11 '08 #1
15 1537
puppydogbuddy
1,923 Expert 1GB
I have a report called rptCarSheet that is grouped on a field called ShiftID. In the ShiftID Group I have several fields that I am trying to input data by the following expression:

[exp] =IIf([AreaID]="1",[Employee]) [exp]

for each field I have changed the AreaID value the the value I need "2" "3" etc.

My problem is that it only works for the first instance entered. I have tried it in the details section as well and get the same issue.

Please tell me what I am doing wrong
Thanks
Dan
First of all, you do not have the correct syntax for the IIf statement. The general syntax is like this:
= IIf(expression, value if true, value if false)

secondly, if AreaID is a numeric data type, you don't put quotes around the return value, quotes are for text data types.

so try your IIf this way, assuming you want the value in the Employee field returned when the AreaID = 1, and you want the value in the exp field returned if the AreaID is not equal to one:

=IIf([AreaID]=1,[Employee], [exp])
Feb 11 '08 #2
DAHMB
147 100+
First of all, you do not have the correct syntax for the IIf statement. The general syntax is like this:
= IIf(expression, value if true, value if false)

secondly, if AreaID is a numeric data type, you don't put quotes around the return value, quotes are for text data types.

so try your IIf this way, assuming you want the value in the Employee field returned when the AreaID = 1, and you want the value in the exp field returned if the AreaID is not equal to one:

=IIf([AreaID]=1,[Employee], [exp])

Thanks for the reply,
Actually there is no exp field, that was an accident of my attempt to enclosed my expression to make it stand out from the rest of my post. My expression is
=IIf([AreaID]=1,[WorkingOfficer]) I have removed the quottes from the number as you said, because AreaID is a number field. HHowever it still only works for the first field in the group. Any ideas?
Dan
Feb 11 '08 #3
puppydogbuddy
1,923 Expert 1GB
Thanks for the reply,
Actually there is no exp field, that was an accident of my attempt to enclosed my expression to make it stand out from the rest of my post. My expression is
=IIf([AreaID]=1,[WorkingOfficer]) I have removed the quottes from the number as you said, because AreaID is a number field. HHowever it still only works for the first field in the group. Any ideas?
Dan
you do not have the correct syntax for the IIf statement. The general syntax is like this:
= IIf(expression, value if true, <<<value if false>>>)

=IIf([AreaID]=1,[WorkingOfficer], "")
Feb 11 '08 #4
DAHMB
147 100+
you do not have the correct syntax for the IIf statement. The general syntax is like this:
= IIf(expression, value if true, <<<value if false>>>)

=IIf([AreaID]=1,[WorkingOfficer], "")
Thanks again but still no luck, It still fills the first field only. I also tried
=IIf([AreaID]=1,[WorkingOfficer],[WorkingOfficer])
and then it returned the first value from the WorkingOfficer field every time regardless of the AreaID I entered.

??
Feb 11 '08 #5
puppydogbuddy
1,923 Expert 1GB
Thanks again but still no luck, It still fills the first field only. I also tried
=IIf([AreaID]=1,[WorkingOfficer],[WorkingOfficer])
and then it returned the first value from the WorkingOfficer field every time regardless of the AreaID I entered.

??
What happened when you posted the code I gave you (see below) ?
=IIf([AreaID]=1,[WorkingOfficer], "")

Please post all of your code related to an IIf statement.
Feb 11 '08 #6
DAHMB
147 100+
What happened when you posted the code I gave you (see below) ?
=IIf([AreaID]=1,[WorkingOfficer], "")

Please post all of your code related to an IIf statement.
When I tried th ecode you gave me it filled in the first field and left all the others blank
I have 10 fields in the group, six of them are based on the code we are trying to fix they are:
=IIf([AreaID]=1,[WorkingOfficer], "")
=IIf([AreaID]=2,[WorkingOfficer], "")
=IIf([AreaID]=3,[WorkingOfficer], "")
=IIf([AreaID]=4,[WorkingOfficer], "")
=IIf([AreaID]=5,[WorkingOfficer], "")
=IIf([AreaID]=6,[WorkingOfficer], "")
The above fields are named simply Off1 through Off6

Thanks for all your help.
Dan
Feb 11 '08 #7
puppydogbuddy
1,923 Expert 1GB
When I tried th ecode you gave me it filled in the first field and left all the others blank
I have 10 fields in the group, six of them are based on the code we are trying to fix they are:
=IIf([AreaID]=1,[WorkingOfficer], "")
=IIf([AreaID]=2,[WorkingOfficer], "")
=IIf([AreaID]=3,[WorkingOfficer], "")
=IIf([AreaID]=4,[WorkingOfficer], "")
=IIf([AreaID]=5,[WorkingOfficer], "")
=IIf([AreaID]=6,[WorkingOfficer], "")
The above fields are named simply Off1 through Off6

Thanks for all your help.
Dan
If the above fields are named simply Off1 through Off6
=IIf([AreaID]=1,[Off1],IIf([AreaID]=2,[Off2],IIf([AreaID]=3,[Off3],IIf([AreaID]=4,[Off4], IIf([AreaID]=5,[Off5],IIf([AreaID]=6,[Off6], ""))))))
Feb 11 '08 #8
DAHMB
147 100+
If the above fields are named simply Off1 through Off6
=IIf([AreaID]=1,[Off1],IIf([AreaID]=2,[Off2],IIf([AreaID]=3,[Off3],IIf([AreaID]=4,[Off4], IIf([AreaID]=5,[Off5],IIf([AreaID]=6,[Off6], ""))))))

No I ment the fields I am trying to fill are named Off1 through Off6 for example the in the controlsource box of Off1 I have =IIf([AreaID]=1,[WorkingOfficer],[WorkingOfficer]) and so on.
Feb 11 '08 #9
DAHMB
147 100+
No I ment the fields I am trying to fill are named Off1 through Off6 for example the in the controlsource box of Off1 I have =IIf([AreaID]=1,[WorkingOfficer],[WorkingOfficer]) and so on.

I also could be going about this all wrong I ama trying to enter the value of the WorkingOfficer Where the AreaID field is the value I enter and the only way I could think of was IIF, is there a WHERE statement I should use instead?
Feb 11 '08 #10
puppydogbuddy
1,923 Expert 1GB
No I ment the fields I am trying to fill are named Off1 through Off6 for example the in the controlsource box of Off1 I have =IIf([AreaID]=1,[WorkingOfficer],[WorkingOfficer]) and so on.
The syntax you are using makes no sense. If Off1 thru Off6 are the values you want to fill for the field [WorkingOfficer], then place the following in the field [WorkingOfficer]:

=IIf([AreaID]=1,"Off1",IIf([AreaID]=2,"Off2",IIf([AreaID]=3,"Off3",IIf([AreaID]=4,"Off4", IIf([AreaID]=5,"Off5",IIf([AreaID]=6,"Off6", ""))))))
Feb 11 '08 #11
cori25
83
Try This:

=iif([AreaID]=1, "WorkingOfficer", "")+iif([AreaID]=2, "WorkingOfficer", "")+iif([AreaID]=3, "WorkingOfficer", "")...

I have put "WorkingOfficer" in parenthesis because I am unaware it this is an existing field or what you would like to have shown as the field. If it is an existing field, put in brackets.

*Reminder* When closing this statement remember you will need to have as many closing parenthesis as there are statements.

Hope this helps




No I ment the fields I am trying to fill are named Off1 through Off6 for example the in the controlsource box of Off1 I have =IIf([AreaID]=1,[WorkingOfficer],[WorkingOfficer]) and so on.
Feb 11 '08 #12
DAHMB
147 100+
Try This:

=iif([AreaID]=1, "WorkingOfficer", "")+iif([AreaID]=2, "WorkingOfficer", "")+iif([AreaID]=3, "WorkingOfficer", "")...

I have put "WorkingOfficer" in parenthesis because I am unaware it this is an existing field or what you would like to have shown as the field. If it is an existing field, put in brackets.

*Reminder* When closing this statement remember you will need to have as many closing parenthesis as there are statements.

Hope this helps
I'm sorry I have confused you
The empty field in the report are called Off1, Off2, Off3 Off4,Off5, Off6
I want to fill those fields with the value of the WorkingOfficer field from my query where the AreaID field in the query is equal to the value entered in the expression.

Thanks sorry for my confusions I am very green at this
Feb 11 '08 #13
puppydogbuddy
1,923 Expert 1GB
I'm sorry I have confused you
The empty field in the report are called Off1, Off2, Off3 Off4,Off5, Off6
I want to fill those fields with the value of the WorkingOfficer field from my query where the AreaID field in the query is equal to the value entered in the expression.

Thanks sorry for my confusions I am very green at this
What happened when you ran my code from Post # 8 (see below)?

If the above fields are named simply Off1 through Off6
=IIf([AreaID]=1,[Off1],IIf([AreaID]=2,[Off2],IIf([AreaID]=3,[Off3],IIf([AreaID]=4,[Off4], IIf([AreaID]=5,[Off5],IIf([AreaID]=6,[Off6], ""))))))
Feb 12 '08 #14
cori25
83
Try This:

=iif([AreaID]=1, "WorkingOfficer", "")+iif([AreaID]=2, "WorkingOfficer", "")+iif([AreaID]=3, "WorkingOfficer", "")...

I have put "WorkingOfficer" in parenthesis because I am unaware it this is an existing field or what you would like to have shown as the field. If it is an existing field, put in brackets.

*Reminder* When closing this statement remember you will need to have as many closing parenthesis as there are statements.

Hope this helps
Feb 12 '08 #15
DAHMB
147 100+
Try This:

=iif([AreaID]=1, "WorkingOfficer", "")+iif([AreaID]=2, "WorkingOfficer", "")+iif([AreaID]=3, "WorkingOfficer", "")...

I have put "WorkingOfficer" in parenthesis because I am unaware it this is an existing field or what you would like to have shown as the field. If it is an existing field, put in brackets.

*Reminder* When closing this statement remember you will need to have as many closing parenthesis as there are statements.

Hope this helps

No luck, thanks everyone but I gave up and have found a work around.

Thanks
Feb 14 '08 #16

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

Similar topics

0
by: Liza | last post by:
Hi, I run Tomcat5.0.24 on Fedora Core 1. I have two hosts defined in server.xml in a following way: <Host name ="WebTest1.something.com" debug="0" appBase="webapps" unpackWARs="true"...
3
by: akparasite | last post by:
Hello all, I have a text box in the page header of my Access report that takes a dynamic string value from a named text box on an open form as its control source, written as follows: ...
1
by: Beowulf | last post by:
I'm having some difficulty and I can't for the life of me figure out why. I have a main report, rptMain, that contains a report header (displays the AppTitle), 3 group headers (one is a header...
1
by: RH | last post by:
Hi, I've made an asp.net application which includes some Crystal Reports. When deploying the app to a Windows server 2003, I get a "Load Report failed" when trying to open a report. On my WinXP...
3
by: Diggler | last post by:
I was working on a report that is populated with three different tables in a strongly-typed dataset. The tables are populated from custom objects rather than directly from SQL Server. I loop...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
6
by: sara | last post by:
I hope someone can help with this. Our director wants to have a report that will have the departments (Retail stores) across the top, stores down the side and the RANKING of the YTD dept sales...
6
by: Josetta | last post by:
Access 2003 I've been experiencing some problems with my "monster" database the last couple of days. I imported all objects into a new database yesterday, which pretty much stopped the crashing...
3
by: Wayne | last post by:
I have several sub-reports in the footer of a main report. In certain situations when one of the sub-reports is pushed down to near the bottom of the page by the sub-reports above it, the...
4
by: Andrew Meador - ASCPA, MCSE, MCP+I, Network+, A+ | last post by:
I have created a report. This report needs to display records between two dates entered by the user. I put two text boxes on the report so I can enter the start and end date - I set them to use an...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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...

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.