Hi
I am having issue with New record " #ERROR "
The logic works fine except that on the new record row it displays #Error. I know it's doing that because the EOIDate and EOIDueDate is blank as (New) and will be so until a new record is entered. Is there a way that I can get it to show blank (or 0) for the new record row? EOI due date is auto calculated once EOI Date is entered. - IIf(IsNull([EOIDate]),0,Switch([EOIReceivedDate]<=[EOIDueDate],"On Time",[EOIReceivedDate]>[EOIDueDate],"Late",[EOIReceivedDate] Is Null And [EOIDueDate]<Date(),"Over Due",[EOIDueDate]>Date(),"Not Due"))
Appreciate guidance.
Thanks
Taruna
6 9537 NeoPa 32,546
Expert Mod 16PB
Hi Taruna.
Your post seems to indicate you're working with a Query rather than a Table. I'll work on that assumption, but you probably know the fewer assumptions we are left with the better. A clear explanation is always very important for any question.
Actually, I tried various approaches to reproduce something like your problem but it never ended up with an updatable query even. Perhaps you should explain exactly what your situation is and we can go from there.
Hi
I had posted this issue last week, I got a response but I was having issues with login so had to created another account, I had sent email to the "contacts us" for help awaiting response.
I do see a response from Neo Pa but I was unable to respond back. Below is a query and the I have for a subform displaying results.
SQL - SELECT PIFNewProjectTBL.ProjectID, PIFNewProjectTBL.MemberID, PIFNewProjectTBL.PDocumentType, PIFNewProjectTBL.PDocuTypeRev, PIFNewProjectTBL.EOIDate, PIFNewProjectTBL.EOIDueDate, PIFNewProjectTBL.EOIReceivedDate, IIf(IsNull([EOIDueDate]),"N/A",Switch([EOIReceivedDate]<=[EOIDueDate],"On Time",[EOIReceivedDate]>[EOIDueDate],"Late",[EOIReceivedDate] Is Null And [EOIDueDate]<Date(),"Over Due",[EOIDueDate]>Date(),"Not Due")) AS PIFRespStat
-
FROM PIFNewProjectTBL;
I am having issue with New record " #ERROR "
The logic works fine except that on the new record row it displays #Error. I know it's doing that because the EOIDate and EOIDueDate is blank as (New) and will be so until a new record is entered. Is there a way that I can get it to show blank (or 0) for the new record row? EOI due date is auto calculated once EOI Date is entered. - IIf(IsNull([EOIDate]),0,Switch([EOIReceivedDate]<=[EOIDueDate],"On Time",[EOIReceivedDate]>[EOIDueDate],"Late",[EOIReceivedDate] Is Null And [EOIDueDate]<Date(),"Over Due",[EOIDueDate]>Date(),"Not Due"))
NeoPa 32,546
Expert Mod 16PB
Hi Sunny.
I hope you get your account situation resolved soon. Technically, we don't allow members to create multiple accounts, but I appreciate there's little choice for you at the moment.
I would guess your problem is related to your complicated IIf() call. As far as I understand, it should work even for the New record. However, I don't know how it will react to the use of the IsNull() function instead of the SQL native Is Null comparison.
Try : - IIf([EOIDueDate] Is Null,'N/A',
-
IIf([EOIReceivedDate] Is Null,
-
IIf([EOIDueDate]<Date(),'Over Due','Not Due'),
-
IIf([EOIReceivedDate]>[EOIDueDate],'Late','On Time'))) AS [PIFRespStat]
It simplifies the code as well as making it make better sense. Switch() is now redundent as it adds nothing you want or need.
NB. I laid the code out for better visibility on this page but there's no need for that when using it. Just strip the new lines from it.
Hello NeoPa,
Thanks for your time. The code is gives invalid syntax error.
Thanks
TMatharu
On a quick glance, line 4 of above code has a missing comma after [EOIDueDate]. Add that and see if it helps
NeoPa 32,546
Expert Mod 16PB
Spot on isladogs. Ta.
@Sunny.
I've corrected the original now so if you copy from it again it should work :-)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Pat |
last post by:
Hello,
I've used Sum() to total bound fields on a continuous form with no problem.
However, I now have a continuous form, on which I use an unbound field to
calculate the number of hours between...
|
by: Kathy |
last post by:
What is the standard technique for handling the fields in the following
scenario on a continuous form?
Multiple Divisions. Each Division has multiple Buildings. Each Building has
a Supervisor.
...
|
by: Leo |
last post by:
Hi everybody,
Is there a way to fill a continuous form with an ADO recordset?
Normally when I populate the form with the recordset only the first record
is shown. I want to fill all records....
|
by: Robert |
last post by:
Need some help to stop me going around in circles on this one....
Have a nested subform (subform2) which simulates a continuous form for the
record on the parent subform.
Subform2 has rows of...
|
by: ApexData |
last post by:
I am using a continuous form for display purposes.
Above this form, a single record is displayed so that when the user
presses my NewButton they can enter a NewRecord which gets added to
the...
|
by: eighthman11 |
last post by:
Hi everyone:
This is probably a pretty simple problem but it is driving me nuts.
Using Access 2000. I have a continuous form which list several
thousand inventory items. The user can enter a...
|
by: eighthman11 |
last post by:
using Access 2003 and sql server version 8.0
Hey everyone. Created a text box where the user types in an Inventory
number and it takes them to that inventory number on the contimuous
form. The...
|
by: ChipR |
last post by:
I'm suddenly having a major problem trying to switch between rows in a continuous form in Access 2007. The form represents a timesheet and has a row for each activity that an employee may work on. ...
|
by: NarenKeer |
last post by:
Hi,
I have been trying to find a solution for this from past one week and no good progress yet.
I just want to avoid the parameter window displayed by query in record source property of a...
|
by: Jeroen3131 |
last post by:
Hello,
I'm developing a database where workinstructions (which consist of Steps) can be created and edited. I'v already completed the "Create" form and it works flawless. Now I'm stuck on the Edit...
|
by: Mushico |
last post by:
How to calculate date of retirement from date of birth
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: Aliciasmith |
last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
|
by: NeoPa |
last post by:
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
|
by: nia12 |
last post by:
Hi there,
I am very new to Access so apologies if any of this is obvious/not clear.
I am creating a data collection tool for health care employees to complete. It consists of a number of...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
| |