I have a table called "tblTempleFuelCellOnly".
When a vehicle is put in shop to be worked on it is given a date called "InshopDate" and vehicle unit and a serial number is also Entered.
If the vehicle is in the parkinglot and not getting worked on it is not given "InShopdate" but a unit name and a serial number.
(I need to find out how many of a certain unit are in shop being worked on.
My strategy is to add the total of a certain unit with a "inshopdate" minus the total of all of a certain unit. So this is what I have But I keep getting a error. Which just says #error
=DCount("[InShopDate]"," tblTempleFuelCellOnly","[Unit] = ('FY10')")-Nz(DCount("[Unit] IN ('FY10' ]"," tblTempleFuelCellOnly"))
Now if there is a better way to this by all means expert please let me know. By the way this is hard coded in a text box.
Microsoft Access
Last Comment
gigifarrow
8/22/2022 - Mon
IrogSinta
Try this:
=DCount("*"," tblTempleFuelCellOnly","[Unit] = 'FY10' And Not IsNull([InShopDate])")
IrogSinta
But what if they finished working on the vehicle? The above will include those in the count.
Jeffrey Coachman
Then we also need to know the datatypes of each fields, as this will effect the syntax (Double quotes versus single quotes)
This should only count Records where Inshop has a value and Unit=FY10
Is this what you wanted?
"I need to find out how many of a certain unit are in shop being worked on."
JeffCoachman
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Please note IrogSintas post as well, as there may be somethings here that need clarification.
Remember that we are trying to address your question as posted.
If it were me, I would simply add a "Inshop" yes/no field to the table instead of relying on a Date/No Date field to determine if it is in the shop or not.
Then the syntax would simply be:
=Dcount("Inshop","tblTempleFuelCellOnly","Inshop=True")
But again, there may still be somethings that need clarification...
JeffCoachman
Jeffrey Coachman
oops...
I mean like this to see inshop (Yes) for a certain unit (FY10)
=Dcount("Inshop","tblTempleFuelCellOnly","Inshop=True" & " AND " & "Unit='FY10'")
Unlimited question asking, solutions, articles and more.
gigifarrow
ASKER
good question! I didnt think of that. "What if they finish working on the vehicle?". All the answers they want are based on dates.
InShopDate=Date working on(date data type)
DateCompleted=when they finished with the vehicle(date data Type)
DateReturned= when the vehicle is picked up.(date Data type)
Units= FY10, FY9, 278Th (Text Fields)
From this information they want to know the following:
1. Total Onsite (meaning both ones not in shop and the ones are in the parking lot)
2. Total Awaiting shop(meaning there in parking lot but have no date yet that they are in shop)
3. Inshopdate(meaning being worked on but not completed yet)
So they can have a inshop date and date completed which would mean it wouldnt be counted as inshop. Sorry guys wasnt thinking about that.
Again thanks for all your help experts!!!
Jeffrey Coachman
Sorry for the rapid fire posts...
Actually you could keep this in a date field (because you need to track the date it went into the shop...)
So my original syntax still might be an option...
And also consider IrogSintas observation that a "DateOutOfShop" (or "DateCompleted") field may also be needed.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
gigifarrow
ASKER
So then to find the total in shop I need to find out if complete is null also? Because it can have a in shop date and also a complete date. So I would need to find out if there is a date for complete and if there is not then count the inshop date?
=DCount("*"," tblTempleFuelCellOnly","[Unit] = 'FY10' And Not IsNull([InShopDate])")- DCount("*"," tblTempleFuelCellOnly","[Unit] = 'FY10' And Not IsNull([isComplete])")
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
Unlimited question asking, solutions, articles and more.
Jeffrey Coachman
Check youir syntax:
=dcount("NameOfField","NameOfTable","YourCriteria")
Your syntax is:
=DCount("tblTempleFuelCellOnly","IsNull(DatePickedUp)" & " AND " & "Unit='FY10'")
...Not sure where you got that syntax from.
...But the sample file I posted seems to do what you were asking...
gigifarrow
ASKER
Jeff thanks for taking the time to go in depth ! you are so thorough. Great job!
=DCount("*"," tblTempleFuelCellOnly","[U