ODBC: Delete Query how to?

E

Ed Warren

I have switched my backend from Access to SQL Server Express 2005.
Since I need to keep my forms, reports, code, etc. I have linked to my
backend tables via ODBC
All is good, except my DELETE query no longer works.

E.g.

DELETE [CLERK INVENTORY].*
FROM [CLERK INVENTORY];


Returns the Error MsgBox("Could not delete from specified tables")


I'm new to the ODBC world, so I'm missing something very basic here. (Yes I
really want to empty the table)
I have written a procedure in SQL Server 2005 Express to do this but cannot
figure out how to call it via the ODBC and/or VBA code.

Thanks

Ed Warren.
 
G

Guest

You may not full admin permission to "delete" data especially to an ODBC
linked database. Please check with your SA.
 
J

John Spencer

Try

DELETE DistinctRow [CLERK INVENTORY].*
FROM [CLERK INVENTORY];

No guarantees, but that often solves problems with deleting records.
 
E

Ed Warren

Thanks John, but that does not solve the problem. Oh, well, back to the
drawing board!

Ed Warren.

John Spencer said:
Try

DELETE DistinctRow [CLERK INVENTORY].*
FROM [CLERK INVENTORY];

No guarantees, but that often solves problems with deleting records.

Ed Warren said:
I have switched my backend from Access to SQL Server Express 2005.
Since I need to keep my forms, reports, code, etc. I have linked to my
backend tables via ODBC
All is good, except my DELETE query no longer works.

E.g.

DELETE [CLERK INVENTORY].*
FROM [CLERK INVENTORY];


Returns the Error MsgBox("Could not delete from specified tables")


I'm new to the ODBC world, so I'm missing something very basic here. (Yes
I really want to empty the table)
I have written a procedure in SQL Server 2005 Express to do this but
cannot figure out how to call it via the ODBC and/or VBA code.

Thanks

Ed Warren.
 
E

Ed Warren

I have full DBA permissions on the SQL Server and Full admin on the Client,
but thanks anyway.

Ed Warren.

caloy said:
You may not full admin permission to "delete" data especially to an ODBC
linked database. Please check with your SA.
--
Caloyski


Ed Warren said:
I have switched my backend from Access to SQL Server Express 2005.
Since I need to keep my forms, reports, code, etc. I have linked to my
backend tables via ODBC
All is good, except my DELETE query no longer works.

E.g.

DELETE [CLERK INVENTORY].*
FROM [CLERK INVENTORY];


Returns the Error MsgBox("Could not delete from specified tables")


I'm new to the ODBC world, so I'm missing something very basic here. (Yes
I
really want to empty the table)
I have written a procedure in SQL Server 2005 Express to do this but
cannot
figure out how to call it via the ODBC and/or VBA code.

Thanks

Ed Warren.
 
J

John Spencer

Does your SQL Server table have a TimeStamp field (SQL 2000 terminology - I
think it got changed in 2005 to something like RowVersion or RowID or
RowNumber)?

I've found having the TimeStamp field (not a datetime field with that name)
necessary to updating records using an ODBC connection from Access. IF I
recall correctly, it is also needed when deleting records.


Ed Warren said:
Thanks John, but that does not solve the problem. Oh, well, back to the
drawing board!

Ed Warren.

John Spencer said:
Try

DELETE DistinctRow [CLERK INVENTORY].*
FROM [CLERK INVENTORY];

No guarantees, but that often solves problems with deleting records.

Ed Warren said:
I have switched my backend from Access to SQL Server Express 2005.
Since I need to keep my forms, reports, code, etc. I have linked to my
backend tables via ODBC
All is good, except my DELETE query no longer works.

E.g.

DELETE [CLERK INVENTORY].*
FROM [CLERK INVENTORY];


Returns the Error MsgBox("Could not delete from specified tables")


I'm new to the ODBC world, so I'm missing something very basic here.
(Yes I really want to empty the table)
I have written a procedure in SQL Server 2005 Express to do this but
cannot figure out how to call it via the ODBC and/or VBA code.

Thanks

Ed Warren.
 
E

Ed Warren

Thanks, John
It does not, I will add same and see if that is the problem. Right now I'm
thinking about just getting around the ODBC and going direct via ADO and
execute a stored procedure.

Ed Warren.

John Spencer said:
Does your SQL Server table have a TimeStamp field (SQL 2000 terminology -
I think it got changed in 2005 to something like RowVersion or RowID or
RowNumber)?

I've found having the TimeStamp field (not a datetime field with that
name) necessary to updating records using an ODBC connection from Access.
IF I recall correctly, it is also needed when deleting records.


Ed Warren said:
Thanks John, but that does not solve the problem. Oh, well, back to the
drawing board!

Ed Warren.

John Spencer said:
Try

DELETE DistinctRow [CLERK INVENTORY].*
FROM [CLERK INVENTORY];

No guarantees, but that often solves problems with deleting records.

I have switched my backend from Access to SQL Server Express 2005.
Since I need to keep my forms, reports, code, etc. I have linked to my
backend tables via ODBC
All is good, except my DELETE query no longer works.

E.g.

DELETE [CLERK INVENTORY].*
FROM [CLERK INVENTORY];


Returns the Error MsgBox("Could not delete from specified tables")


I'm new to the ODBC world, so I'm missing something very basic here.
(Yes I really want to empty the table)
I have written a procedure in SQL Server 2005 Express to do this but
cannot figure out how to call it via the ODBC and/or VBA code.

Thanks

Ed Warren.
 
J

John Spencer

Post back and let us know how you solved your problem. Executing the stored
proc will probably be fastest, but ...
Ed Warren said:
Thanks, John
It does not, I will add same and see if that is the problem. Right now
I'm thinking about just getting around the ODBC and going direct via ADO
and execute a stored procedure.

Ed Warren.

John Spencer said:
Does your SQL Server table have a TimeStamp field (SQL 2000 terminology -
I think it got changed in 2005 to something like RowVersion or RowID or
RowNumber)?

I've found having the TimeStamp field (not a datetime field with that
name) necessary to updating records using an ODBC connection from Access.
IF I recall correctly, it is also needed when deleting records.


Ed Warren said:
Thanks John, but that does not solve the problem. Oh, well, back to the
drawing board!

Ed Warren.

Try

DELETE DistinctRow [CLERK INVENTORY].*
FROM [CLERK INVENTORY];

No guarantees, but that often solves problems with deleting records.

I have switched my backend from Access to SQL Server Express 2005.
Since I need to keep my forms, reports, code, etc. I have linked to my
backend tables via ODBC
All is good, except my DELETE query no longer works.

E.g.

DELETE [CLERK INVENTORY].*
FROM [CLERK INVENTORY];


Returns the Error MsgBox("Could not delete from specified tables")


I'm new to the ODBC world, so I'm missing something very basic here.
(Yes I really want to empty the table)
I have written a procedure in SQL Server 2005 Express to do this but
cannot figure out how to call it via the ODBC and/or VBA code.

Thanks

Ed Warren.
 
E

Ed Warren

BLUSH!!!

Sometimes you trip over the really stupid stuff.

I had 'lost' my key field in the transfer from MS Access to SQL server.
Once I rebult the primary key and relinked the tables with the primary key
everything works as it should.

Thanks for the help though, I learned something(s) about ODBC.

Ed Warren.

John Spencer said:
Post back and let us know how you solved your problem. Executing the
stored proc will probably be fastest, but ...
Ed Warren said:
Thanks, John
It does not, I will add same and see if that is the problem. Right now
I'm thinking about just getting around the ODBC and going direct via ADO
and execute a stored procedure.

Ed Warren.

John Spencer said:
Does your SQL Server table have a TimeStamp field (SQL 2000
terminology - I think it got changed in 2005 to something like
RowVersion or RowID or RowNumber)?

I've found having the TimeStamp field (not a datetime field with that
name) necessary to updating records using an ODBC connection from
Access. IF I recall correctly, it is also needed when deleting records.


Thanks John, but that does not solve the problem. Oh, well, back to
the drawing board!

Ed Warren.

Try

DELETE DistinctRow [CLERK INVENTORY].*
FROM [CLERK INVENTORY];

No guarantees, but that often solves problems with deleting records.

I have switched my backend from Access to SQL Server Express 2005.
Since I need to keep my forms, reports, code, etc. I have linked to
my backend tables via ODBC
All is good, except my DELETE query no longer works.

E.g.

DELETE [CLERK INVENTORY].*
FROM [CLERK INVENTORY];


Returns the Error MsgBox("Could not delete from specified tables")


I'm new to the ODBC world, so I'm missing something very basic here.
(Yes I really want to empty the table)
I have written a procedure in SQL Server 2005 Express to do this but
cannot figure out how to call it via the ODBC and/or VBA code.

Thanks

Ed Warren.
 

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