basic sql question about quotes

J

Jim

I have a query, which works ok, but I'm trying to take the results of
the query and update a field in another table with the result

When I try to make a sql statement in vba, it chokes on the quotes.
here is sql from the query:

SELECT DISTINCT tblLands.Acct,
ConcatRelated("LegalDescription","tblLands","Acct = """ & [Acct] &
"""") AS LegalDesc
FROM tblLands
WHERE
(((tblLands.Acct)=[Forms]![mainform]![subfrmLands].[Form]![Acct]));

It chokes on the first quote of LegalDescription.

(Using Allen Browne's function to concatenate )

Basically, I'm trying to take many legal descriptions and
concantentate them into one "summary" field. (its ok if the 255
character limit forces it to truncate.)

I want the afterupdate event of the subfrmLands to fire, running the
vba code which will update the existing "summary" field in the other
table. (this is one record at a time)

Right now, I can accomplish this by using a select querys, and then
an update query. But would like to accomplish this in code.

Thanks, Jim
 
J

Jim

I have a query, which works ok, but I'm trying to take the results of
the query and update a field in another table with the result

When I try to make a sql statement in vba, it chokes on the quotes.
here is sql from the query:

SELECT DISTINCT tblLands.Acct,
ConcatRelated("LegalDescription","tblLands","Acct = """ & [Acct] &
"""") AS LegalDesc
FROM tblLands
WHERE
(((tblLands.Acct)=[Forms]![mainform]![subfrmLands].[Form]![Acct]));

It chokes on the first quote of LegalDescription.

(Using Allen Browne's function to concatenate )

Basically, I'm trying to take many legal descriptions and
concantentate them into one "summary" field. (its ok if the 255
character limit forces it to truncate.)

I want the afterupdate event of the subfrmLands to fire, running the
vba code which will update the existing "summary" field in the other
table. (this is one record at a time)

Right now, I can accomplish this by using a select querys, and then
an update query. But would like to accomplish this in code.

Thanks, Jim

[Acct] is text, by the way.........Jim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top