473,320 Members | 1,857 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,320 software developers and data experts.

Question on how to combine iif() and IsNull?

I am working to refine a form that we use to enter quite a bit of data. Basically, I have a datasheet view form in which the following times are entered regarding trucking work:

PlantArrive | PlantLeave | SiteArrive | SiteLeave | ReturnTime

The Return Time for each record is the same as the Plant Arrive time of the next record unless it is the very last trip for that day for that truck. Due to this the data entry person must enter the same value twice most of the time. I consider this wasted effort. I would like to program the form, if possible, to do this instead.

Is it possible to put a iif(IsNull([ReturnTime]), ... type statement in this place? If it is please help me understand how to tell it to get the [PlantArrive] time from the NEXT record, unless there is no next record or unless a time is manually entered (as in the very last record for that day)?

If there is a better way to do this please let me know as well. I am concerned about doing this at a query level because I believe it is wise the for actual data to exist somewhere in the tables in case we want to run different reports or anlysis down the road or if someone else down the road manages this database. (I am open to comments on this rational.)

I hope I have explained this clearly. If not please let me know what part is confusing.
Mar 20 '07 #1
3 1880
Denburt
1,356 Expert 1GB
There are a few ways you can do this. I am not sure if this will work for your needs but I think the easiest would be to set the default value of the "plant arrive time" field to now() and that will give you the current time.
Mar 20 '07 #2
I am confused as to how that would solve the problem. This data is entered manually by a data entry person after the fact. Usually it is 1-2 days later. It seems that the function you suggest would put that time that the data entry person was working rather than the actual return time.

Am I misunderstanding your suggestion?
Mar 20 '07 #3
Denburt
1,356 Expert 1GB
Try this and see if that is a little better.


Private Sub Text0_AfterUpdate()
Dim MyVal
MyVal = Me!ReturnTime
DoCmd.GoToRecord , , acNewRec
Me!PlantArrive = MyVal
End Sub
Mar 20 '07 #4

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

Similar topics

3
by: Susie Swint | last post by:
I have the following IIf statement which worked in Access 95 but will not work in Access 2002. The error message I get is that the expression is typed incorrectly, or is too complex to be...
2
by: misschristalee | last post by:
I'm having a brain blockage day.... Scenario: Search Form with 6 text boxes Query has same six fields Each has this IIF: IIf(IsNull(!!),"",!!) with each dictating the correct text box of...
1
by: Mike Cooper | last post by:
Hi everyone, This is a tough one. I have a database full of solicitations, identifying a customer and recording initial call, first followup, second followup, etc. My boss want to be able to...
1
by: Will | last post by:
In a query I have this as one of the fields: Cost: IIf(Left(!,1)="R" Or (Left(!,1)="X" ,**(IIf(IsNull(),1,1+)),0). This works fine. I want to add Or (Left(!,1)="Z"), so the code becomes Cost:...
3
by: BerkshireGuy | last post by:
Hello all. This expression is in my query and it works well. However, if both continues are false, I want it to say "Not Yet Issued". I've added that and getting an #ERROR. Any ideas? ...
3
by: Alan | last post by:
I'm having brain fade today... Can the recordsource in a Form's properties do more than one select statement based on criteria? On a popup subform I'm trying to display matching records from a...
8
by: Ragbrai | last post by:
Howdy All, I have a query that is used for filtering results to be used in a combo box. The query needs to test fields from both a table and then unbound text boxes on the form that also contains...
2
by: commodityintelligence | last post by:
Hello, I am trying to create an IF Statement that checks if a field has a null value. Table mats by sku is a table with skus and 2 columns of data called Index and Category Index Index is...
5
by: power2005 | last post by:
Hi Experts I'm having a problem with IIf statement and it's driving me crazy... i'm a total newbie and i've spent hours to make it work but to no avail... what I'm trying to do is to have a...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.