aziz rasul
Active member
- Local time
- Today, 14:48
- Joined
- Jun 26, 2000
- Messages
- 1,935
I have the following code:
The single quotes, given in red above (ORDER BY line) , works in code i.e. I get no errors, but when I open the query, it doesn't like it. If I change: -
'dd/mm/yy hh:nn:ss'
to
"dd/mm/yy hh:nn:ss"
in the query then it's happy. How do I change qdf.SQL to get it to work. I have tried
"""dd/mm/yy hh:nn:ss"""
but it doesn't work.
Code:
Set qdf = CurrentDb.QueryDefs("qryUnassignedWaitingListCookwell")
strSQL = "SELECT Format(tblGroupUnassignedWaitingList!dateonwaitinglist & ' ' & tblGroupUnassignedWaitingList!timeonwaitinglist,'dd/mm/yy hh:nn:ss') AS [On Waiting List], tblGroupUnassignedWaitingList.enquirerID, tblGroupUnassignedWaitingList.GeneralEnquiryID, [Surname] & ', ' & [firstname] AS Name, IIf(IsNull([housenumber]),'',[housenumber] & ' ') & IIf(IsNull([streetname]),'',[streetname] & ', ') & IIf(IsNull(tblAreas!areaname),'',tblAreas!areaname & ', ') & IIf(IsNull([towncity]),'',[towncity] & ', ') & IIf(IsNull([County]),'',[County]) AS Address, tblEnquirers.DOB, tblEnquirers.Gender, tblGUWListCookwell.timeslot, tblGUWListCookwell.areaID, tblEnquirers.postcode, tblEnquirers.telno, tblEnquirers.Disability, tblEnquirers.professional " & _
"FROM (tblEnquirers LEFT JOIN tblAreas ON tblEnquirers.areaID = tblAreas.areaID) INNER JOIN (tblGUWListCookwell INNER JOIN tblGroupUnassignedWaitingList ON (tblGUWListCookwell.groupprojectID = tblGroupUnassignedWaitingList.groupprojectID) AND (tblGUWListCookwell.enquirerID = tblGroupUnassignedWaitingList.enquirerID) AND (tblGUWListCookwell.dateonwaitinglist = tblGroupUnassignedWaitingList.dateonwaitinglist) AND (tblGUWListCookwell.timeonwaitinglist = tblGroupUnassignedWaitingList.timeonwaitinglist) AND (tblGUWListCookwell.GeneralEnquiryID = tblGroupUnassignedWaitingList.GeneralEnquiryID)) ON tblEnquirers.enquirerID = tblGroupUnassignedWaitingList.enquirerID " & _
"WHERE (((tblGroupUnassignedWaitingList.groupprojectID) = 2)) " & _
"ORDER BY CDate(Format(tblGroupUnassignedWaitingList!dateonwaitinglist & ' ' & tblGroupUnassignedWaitingList!timeonwaitinglist,[COLOR="Red"][B]'[/B][/COLOR]dd/mm/yy hh:nn:ss[COLOR="Red"][B]'[/B][/COLOR]));"
qdf.SQL = strSQL
The single quotes, given in red above (ORDER BY line) , works in code i.e. I get no errors, but when I open the query, it doesn't like it. If I change: -
'dd/mm/yy hh:nn:ss'
to
"dd/mm/yy hh:nn:ss"
in the query then it's happy. How do I change qdf.SQL to get it to work. I have tried
"""dd/mm/yy hh:nn:ss"""
but it doesn't work.
Last edited: