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  dBforums > Data Access, Manipulation & Batch Languages > Visual Basic > Concatenate values related query records

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-10-10, 18:35
TheseFeet TheseFeet is offline
Registered User
 
Join Date: Sep 2010
Posts: 1
Concatenate values related query records

Hi,
I'm using an Allen Brown concatenate related records code from Allen Browne (Microsoft Access tips: Concatenate values from related records). The code works fine for 'tables' in MS Access, but the code fails if I try to run it from a query (even though the fields and data in the query are identical to the table).
If it helps I'll post the code, but my basic questions is: "What's inherently different from running a loop code from a table vs. running the same code from a query?" My only thought is that it takes the query 5-10 seconds to process the data, and this is triggering an error message.
Thoughts?

thanks in advance,
Reply With Quote
  #2 (permalink)  
Old 09-14-10, 13:40
Teddy Teddy is offline
Purveyor of Discontent
 
Join Date: Mar 2003
Location: The Bottom of The Barrel
Posts: 6,075
What kind of "fails" are we talking here? He does have a note about some garbage text getting generated if you use it as a source to something else.

I think the problem you're hitting when trying to use this in the source of a query (as opposed to using the results as the source to another query), is the code doing this:

"SELECT " & strField & " FROM " & strTable

If strTable is, in fact, a physical table, then nothing stops you from running the above statement. However, if strTable is a QUERY that is attempting to in turn call "SELECT ... FROM strTable", then you enter in to an infinite recursive loop. This is because your query must call ConcatRelated() to return any results at all. ConcatRelated() REQUIRES the ability to query the underlying DataSource WITHOUT the concatenated field present in order to return a result. When you're doing this from a query, that query does not exist without the concatenated field.

Make sense?
__________________
oh yeah... documentation... I have heard of that.

*** What Do You Want In The MS Access Forum? ***
Reply With Quote
Reply

Tags
access, concatenate, queries, related records, vba

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On