Ta for looking.
I am setting this SQL to the recordsource of a report but it's complaining
about a syntax error.
"SELECT tblemp.Surname, tblemp.Forename, tblAbsence.AbsenceDate,
tblAbsence.AbsenceReason, FROM tblemp INNER JOIN tblAbsence ON tblemp.ID =
tblAbsence.ID WHERE (((tblAbsence.AbsenceDate) Between " & Datefrom & " And
" & Dateto & " AND ((tblemp.DateOfLeaving) Is Null));"
I'm hoping to cover a date range as specified by the user - i have captured
these dates in the variables Dateform and Dateto.
As I say my raw SQL is bad so any help much appreciated, deadline looming (:
thanks
Martin 3 1639
Whenever I'm using Dates in a query like this, I usually surround them with
#, like this:
"SELECT tblemp.Surname, tblemp.Forename, tblAbsence.AbsenceDate,
tblAbsence.AbsenceReason, FROM tblemp INNER JOIN tblAbsence ON tblemp.ID =
tblAbsence.ID WHERE (((tblAbsence.AbsenceDate) Between #" & Datefrom & "#
And
#" & Dateto & "# AND ((tblemp.DateOfLeaving) Is Null));"
Hope that helps,
cheers,
Matt.
"Deano" <ma************@hotmail.com> wrote in message
news:wY*******************@wards.force9.net... Ta for looking.
I am setting this SQL to the recordsource of a report but it's complaining about a syntax error.
"SELECT tblemp.Surname, tblemp.Forename, tblAbsence.AbsenceDate, tblAbsence.AbsenceReason, FROM tblemp INNER JOIN tblAbsence ON tblemp.ID = tblAbsence.ID WHERE (((tblAbsence.AbsenceDate) Between " & Datefrom & "
And " & Dateto & " AND ((tblemp.DateOfLeaving) Is Null));"
I'm hoping to cover a date range as specified by the user - i have
captured these dates in the variables Dateform and Dateto.
As I say my raw SQL is bad so any help much appreciated, deadline looming
(: thanks Martin
Matt. wrote: Whenever I'm using Dates in a query like this, I usually surround them with #, like this:
"SELECT tblemp.Surname, tblemp.Forename, tblAbsence.AbsenceDate, tblAbsence.AbsenceReason, FROM tblemp INNER JOIN tblAbsence ON tblemp.ID = tblAbsence.ID WHERE (((tblAbsence.AbsenceDate) Between #" & Datefrom & "# And #" & Dateto & "# AND ((tblemp.DateOfLeaving) Is Null));"
Hope that helps,
cheers, Matt.
Thanks Matt, I included your amendments and then finally cracked it by
taking a leading bracket out just after the WHERE clause;
"SELECT tblemp.Surname, tblemp.Forename, tblAbsence.AbsenceDate,
tblAbsence.AbsenceReason, FROM tblemp INNER JOIN tblAbsence ON
tblemp.ID = tblAbsence.ID WHERE ((tblAbsence.AbsenceDate) Between #"
& Datefrom & "# And
#" & Dateto & "# AND ((tblemp.DateOfLeaving) Is Null));"
"Deano" <ma************@hotmail.com> wrote in message news:<wY*******************@wards.force9.net>... Ta for looking.
I am setting this SQL to the recordsource of a report but it's complaining about a syntax error.
"SELECT tblemp.Surname, tblemp.Forename, tblAbsence.AbsenceDate, tblAbsence.AbsenceReason, FROM tblemp INNER JOIN tblAbsence ON tblemp.ID = tblAbsence.ID WHERE (((tblAbsence.AbsenceDate) Between " & Datefrom & " And " & Dateto & " AND ((tblemp.DateOfLeaving) Is Null));"
I'm hoping to cover a date range as specified by the user - i have captured these dates in the variables Dateform and Dateto.
As I say my raw SQL is bad so any help much appreciated, deadline looming (:
thanks Martin
Martin,
you have to wrap the date fields in Date delimiters (#)
"SELECT tblemp.Surname, tblemp.Forename, tblAbsence.AbsenceDate,
tblAbsence.AbsenceReason, FROM tblemp INNER JOIN tblAbsence ON tblemp.ID =
tblAbsence.ID WHERE (((tblAbsence.AbsenceDate) Between #" & Me.Datefrom & "# And
#" & Me.Dateto & "# AND ((tblemp.DateOfLeaving) Is Null));"
HTH,
Pieter This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Michael DeLawter |
last post by:
Using Access 2002.
I have a chart in a report that is currently based on a query in which
the user enters the start and end date for the chart to display. Both
the start and end dates have been...
|
by: No Spam |
last post by:
Dear Access 2000 users,
I have a crosstab query that puts together certain information
perfectly. It has a criteria that is based on a form that limits how
many columns are returned based on...
|
by: tim.pascoe |
last post by:
I'm running into a problem using dates in a query which supplied data
to a report. The WHERE clause of the query is dynamically generated,
based on selections made on a form. Users enter dates in...
|
by: u473 |
last post by:
I am scratching my head with the required quotes and parentheses.
I started with an existing working Query with Running Total
by date.
Now I need to produce a running total by quarter day, so I...
|
by: sparky |
last post by:
I've been working on an ASP driven website, on a client's web hosting
space. One of the project requirements was the ability for the client
to be able to upload files through an HTTP form. No...
|
by: Rob Woodworth |
last post by:
Hi,
I'm having serious problems getting my report to work. I need to
generate a timesheet report which will contain info for one employee between
certain dates (one week's worth of dates). I...
|
by: JJM0926 |
last post by:
I'm trying to create a running totals query in access 97. I have
followed the directions on how to do it from Microsofts website
article id 138911. I took their code they had and replaced it with...
|
by: bhipwell via AccessMonster.com |
last post by:
Hello,
I have hit the "Cannot open any more databases" and "System resource
exceeded" errors. Knew this was coming, but as I got closer to finishing the
database, I hoped it wouldn't be an...
|
by: ARC |
last post by:
Hello all,
So I'm knee deep in this import utility program, and am coming up with all
sorts of "gotcha's!".
1st off. On a "Find Duplicates Query", does anyone have a good solution for...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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...
|
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,...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| | |