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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get the last added records ID

Status
Not open for further replies.

lechuck

Programmer
Sep 4, 2000
26
SE
I have a table MyTable that contain too columns: Col1 that stores chars and a ID column configured as a counter. I did a test on SQL7.0 Server with the following code:

INSERT INTO MyTable(Col1)
VALUES('MyValue')
SELECT @@IDENTITY AS 'NewID';

It insert MyValue into table MyTable, then it returs the new ID of MyValue.

Now I tried the same code against a exact same Table in a Access database, but i get the error message:
Semicolon missing at the end of the SQL-expression.

What shall I do to get the SQL question to work against Access?

Regards
LeChuck
 
Hi, LeChuck!

Create trying Append (Insert) query based on needed table by using Access Query builder in design window. Then look at SQL window of Query builder for right SQL syntax.

Aivars


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top