A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Duane Hookum's Concatentate - trouble in Access 2007?



 
 
Thread Tools Display Modes
  #1  
Old April 29th, 2010, 04:53 PM posted to microsoft.public.access.queries
HLCruz via AccessMonster.com
external usenet poster
 
Posts: 35
Default Duane Hookum's Concatentate - trouble in Access 2007?

I have a database that I created in Access 2003; there are a few places where
I use the code from Duane Hookum's concatentae funcion in my database.

The code has worked perfectly for well over a year in several instances,
however suddenly it won't work anywhere. I get a run-time error - Syntax
error (missing operator) in query expression - 'MailingID =' ... when I
debug it, the following line of code is hightlighted:

Set rs= db.OpenRecordset (PastStrSQL)

I haven't changed any of my code, however we did move to Access 2007 recently.
If the SQL doesn't appear to be the problem, I would appreciate any
suggestions on where to troubleshoot. I really miss using this funtion.

Thank you,
Heather

Here is a sample of the SQL of one of the queries that no longer works ...

SELECT sysqryShiningStarHouseholdIDs.MailingID, Concatenate("SELECT LastName
FROM sysqryShiningStars WHERE MailingID =" & [MailingID] & " ORDER BY
LastName") AS LastNames, Concatenate("SELECT FirstName FROM
sysqryShiningStars WHERE MailingID =" & [MailingID] & " ORDER BY FirstName")
AS FirstNames, Concatenate("SELECT Age FROM sysqryShiningStars WHERE
MailingID =" & [MailingID] & " ORDER BY FirstName") AS Age
FROM sysqryShiningStarHouseholdIDs;


SQL for sqryShiningStarHouseholdIDs:
SELECT sysqryShiningStarDesignators.MailingID, First
(sysqryShiningStarDesignators.ProfileCode) AS FirstOfProfileCode
FROM sysqryShiningStarDesignators
GROUP BY sysqryShiningStarDesignators.MailingID;

SQL for sysqryShiningStarDesignators:
SELECT tblMailingList.MailingID, tblDesignators.ProfileCode
FROM tblMailingList RIGHT JOIN tblDesignators ON tblMailingList.MailingID =
tblDesignators.MailingID
WHERE (((tblDesignators.ProfileCode)="ShiningStar"));

--
Message posted via http://www.accessmonster.com

Ads
  #2  
Old April 29th, 2010, 10:26 PM posted to microsoft.public.access.queries
Dorian
external usenet poster
 
Posts: 542
Default Duane Hookum's Concatentate - trouble in Access 2007?

You need to tell us what is in PastStrSQL since that is where the trouble
seems to lie. To find out you can place the following line above your line,
e.g.:
Msgbox PastStrSQL,,"SQL"
Set rs= db.OpenRecordset (PastStrSQL)
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".


"HLCruz via AccessMonster.com" wrote:

I have a database that I created in Access 2003; there are a few places where
I use the code from Duane Hookum's concatentae funcion in my database.

The code has worked perfectly for well over a year in several instances,
however suddenly it won't work anywhere. I get a run-time error - Syntax
error (missing operator) in query expression - 'MailingID =' ... when I
debug it, the following line of code is hightlighted:

Set rs= db.OpenRecordset (PastStrSQL)

I haven't changed any of my code, however we did move to Access 2007 recently.
If the SQL doesn't appear to be the problem, I would appreciate any
suggestions on where to troubleshoot. I really miss using this funtion.

Thank you,
Heather

Here is a sample of the SQL of one of the queries that no longer works ...

SELECT sysqryShiningStarHouseholdIDs.MailingID, Concatenate("SELECT LastName
FROM sysqryShiningStars WHERE MailingID =" & [MailingID] & " ORDER BY
LastName") AS LastNames, Concatenate("SELECT FirstName FROM
sysqryShiningStars WHERE MailingID =" & [MailingID] & " ORDER BY FirstName")
AS FirstNames, Concatenate("SELECT Age FROM sysqryShiningStars WHERE
MailingID =" & [MailingID] & " ORDER BY FirstName") AS Age
FROM sysqryShiningStarHouseholdIDs;


SQL for sqryShiningStarHouseholdIDs:
SELECT sysqryShiningStarDesignators.MailingID, First
(sysqryShiningStarDesignators.ProfileCode) AS FirstOfProfileCode
FROM sysqryShiningStarDesignators
GROUP BY sysqryShiningStarDesignators.MailingID;

SQL for sysqryShiningStarDesignators:
SELECT tblMailingList.MailingID, tblDesignators.ProfileCode
FROM tblMailingList RIGHT JOIN tblDesignators ON tblMailingList.MailingID =
tblDesignators.MailingID
WHERE (((tblDesignators.ProfileCode)="ShiningStar"));

--
Message posted via http://www.accessmonster.com

.

  #3  
Old April 30th, 2010, 04:33 AM posted to microsoft.public.access.queries
Duane Hookom[_4_]
external usenet poster
 
Posts: 316
Default Duane Hookum's Concatentate - trouble in Access 2007?

I expect there is a null value of MailingID in your query. Try to filter
them out.

--
Duane Hookom
MS Access MVP


"HLCruz via AccessMonster.com" [email protected] wrote in message
news:[email protected]
I have a database that I created in Access 2003; there are a few places
where
I use the code from Duane Hookum's concatentae funcion in my database.

The code has worked perfectly for well over a year in several instances,
however suddenly it won't work anywhere. I get a run-time error - Syntax
error (missing operator) in query expression - 'MailingID =' ... when I
debug it, the following line of code is hightlighted:

Set rs= db.OpenRecordset (PastStrSQL)

I haven't changed any of my code, however we did move to Access 2007
recently.
If the SQL doesn't appear to be the problem, I would appreciate any
suggestions on where to troubleshoot. I really miss using this funtion.

Thank you,
Heather

Here is a sample of the SQL of one of the queries that no longer works ...

SELECT sysqryShiningStarHouseholdIDs.MailingID, Concatenate("SELECT
LastName
FROM sysqryShiningStars WHERE MailingID =" & [MailingID] & " ORDER BY
LastName") AS LastNames, Concatenate("SELECT FirstName FROM
sysqryShiningStars WHERE MailingID =" & [MailingID] & " ORDER BY
FirstName")
AS FirstNames, Concatenate("SELECT Age FROM sysqryShiningStars WHERE
MailingID =" & [MailingID] & " ORDER BY FirstName") AS Age
FROM sysqryShiningStarHouseholdIDs;


SQL for sqryShiningStarHouseholdIDs:
SELECT sysqryShiningStarDesignators.MailingID, First
(sysqryShiningStarDesignators.ProfileCode) AS FirstOfProfileCode
FROM sysqryShiningStarDesignators
GROUP BY sysqryShiningStarDesignators.MailingID;

SQL for sysqryShiningStarDesignators:
SELECT tblMailingList.MailingID, tblDesignators.ProfileCode
FROM tblMailingList RIGHT JOIN tblDesignators ON tblMailingList.MailingID
=
tblDesignators.MailingID
WHERE (((tblDesignators.ProfileCode)="ShiningStar"));

--
Message posted via http://www.accessmonster.com

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:38 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright 2004-2019 OfficeFrustration.
The comments are property of their posters.