Zydeceltico
Registered User.
- Local time
- Today, 07:30
- Joined
- Dec 5, 2017
- Messages
- 843
Hi All,
I'm trying to design a query to run on a command button (cmdGetResults) on a form after a user has selected two dates: each from a different control (i.e,, txtDateTime1 and txtDateTime2).
Once the two dates are selected, I'd like to click cmdGetResults and have a report open with the results grouped by Date and then job number. The query will get more involved after this but I'm pretty sure I can figure the rest of it out. I've been searching here and google and am just getting more confused.
I keep getting an "you didn't aggregate" message.
I've attached a screen shot of the current returned datasheet and here's the current SQL.
BTW - I'm writing this post because I am foreseeing issues with the DateTime field even before I start trying to work through this.
First things first though: Number one question: How do I pass the two user-selected dates from controls on the form to the SQL statement using "BETWEEN" so that the user defines an exact range?
Also, as you can see in the pic, I store Date and Time in the same field. When and inspection is performed that field defaults =Now(). When I get to the report stage I would like to group by Date only and then have line items by Time and JobNumber. What should I be considering to be able to do this?
Thanks1
Tim
I'm trying to design a query to run on a command button (cmdGetResults) on a form after a user has selected two dates: each from a different control (i.e,, txtDateTime1 and txtDateTime2).
Once the two dates are selected, I'd like to click cmdGetResults and have a report open with the results grouped by Date and then job number. The query will get more involved after this but I'm pretty sure I can figure the rest of it out. I've been searching here and google and am just getting more confused.
I keep getting an "you didn't aggregate" message.
I've attached a screen shot of the current returned datasheet and here's the current SQL.
Code:
SELECT tblinspectionevent.datetime,
tbljobs.jobnumber,
lutblinspectiontypes.inspectiontype
FROM lutblinspectiontypes
INNER JOIN (tbljobs
INNER JOIN tblinspectionevent
ON tbljobs.job_id = tblinspectionevent.job_fk)
ON lutblinspectiontypes.inspectiontype_id =
tblinspectionevent.inspectiontype_fk;
BTW - I'm writing this post because I am foreseeing issues with the DateTime field even before I start trying to work through this.
First things first though: Number one question: How do I pass the two user-selected dates from controls on the form to the SQL statement using "BETWEEN" so that the user defines an exact range?
Also, as you can see in the pic, I store Date and Time in the same field. When and inspection is performed that field defaults =Now(). When I get to the report stage I would like to group by Date only and then have line items by Time and JobNumber. What should I be considering to be able to do this?
Thanks1
Tim