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

Continuous Form #Error On New Record

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.
Expand|Select|Wrap|Line Numbers
  1. 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
Mar 24 '22 #1
6 9659
NeoPa
32,556 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.
Mar 24 '22 #2
TMatharu
4 Nibble
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
Expand|Select|Wrap|Line Numbers
  1. 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
  2. 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.
Expand|Select|Wrap|Line Numbers
  1. IIf(IsNull([EOIDate]),0,Switch([EOIReceivedDate]<=[EOIDueDate],"On Time",[EOIReceivedDate]>[EOIDueDate],"Late",[EOIReceivedDate] Is Null And [EOIDueDate]<Date(),"Over Due",[EOIDueDate]>Date(),"Not Due"))
Apr 1 '22 #3
NeoPa
32,556 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 :
Expand|Select|Wrap|Line Numbers
  1. IIf([EOIDueDate] Is Null,'N/A',
  2. IIf([EOIReceivedDate] Is Null,
  3. IIf([EOIDueDate]<Date(),'Over Due','Not Due'),
  4. 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.
Apr 2 '22 #4
TMatharu
4 Nibble
Hello NeoPa,

Thanks for your time. The code is gives invalid syntax error.

Thanks

TMatharu
Apr 2 '22 #5
isladogs
456 Expert Mod 256MB
On a quick glance, line 4 of above code has a missing comma after [EOIDueDate]. Add that and see if it helps
Apr 2 '22 #6
NeoPa
32,556 Expert Mod 16PB
Spot on isladogs. Ta.

@Sunny.

I've corrected the original now so if you copy from it again it should work :-)
Apr 3 '22 #7

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

Similar topics

3
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...
4
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. ...
3
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....
20
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...
3
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...
5
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...
13
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...
2
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. ...
4
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...
6
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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
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.