Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combining Update and Select in Crystal's SQL Command 2

Status
Not open for further replies.

begin2know

Technical User
Mar 29, 2004
4
US
I've read through the various threads with much interest in using Crystal's Add Command capability, but can't figure out how to combine Update and Select statements in one query. I've tried using a semicolon and parentheses-- with the semicolon I get "Characters found after end of SQL statement," and with parentheses I get "Syntax error in union query." I'm connecting with ODBC to an Access database. Here's what I have without the punctuation...

update user_values
set amount1={?amt1}, amount2={?amt2}, numeric1={?num1}
where user_values.user_values={?userval}
select * from user_values

Any help would be greatly appreciated. Thanks.
~stephe
 
I have tried everything that I can imagine. I even simplified matters by creating a test database with no security (thinking that might be part of the problem). My query is now...

UPDATE "Customer"
SET "Customer"."Contact" = '{?Name}'
WHERE "Customer"."Customer" = '{?Company}'
SELECT * FROM "Customer"

Looks to me like the format from the example listed, but it still gets errors. I get an invalid syntax error if I don't separate the two statements, and if I place a semicolon between them, I'm told there are characters after the end of the SQL statement. I'm lost!
 
I would guess that the problem is with Access, as I did test an update/select using SQL Server a few months ago.

The optimizer probably can't combine SQL Statements as Access uses the ; to delineate parameters in Queries.

-k

 
Ido and k~ Thank you each for your reply. Perhaps it is a limitation of the Access ODBC driver. I'll pursue other options for now.
Regards ~stephe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top