Delete record using vba

L

.Len B

I have a table whose primary key is text (length 50).
I need to programmatically delete one record.

What is the best way, just use DoCmd.RunSQL or is there
a better way? I know the PK.
 
B

Bernd Gilles

Hi Len,

..Len B said:
I have a table whose primary key is text (length 50).
I need to programmatically delete one record.

What is the best way, just use DoCmd.RunSQL or is there
a better way? I know the PK.

i would use CurrentDb.Execute "DELETE * FROM ..."
because this will not generate a warning like DoCmd.RunSQL will do.
 
L

.Len B

| Hi Len,
|
| .Len B schrieb:
| > I have a table whose primary key is text (length 50).
| > I need to programmatically delete one record.
| >
| > What is the best way, just use DoCmd.RunSQL or is there
| > a better way? I know the PK.
|
| i would use CurrentDb.Execute "DELETE * FROM ..."
| because this will not generate a warning like DoCmd.RunSQL will do.
|
| --
| Gruß, Bernd
| ---
| Access goes Subversion - http://oasis.dev2dev.de


Thanks very much Bernd. I was wondering how to suppress the warning.
I'm not using * though. My string worked using RunSQL. Since I only
want to kill one record I guess it makes no difference.
"DELETE FROM tblSuspended WHERE LogonName = '" & gstrLogonName & "'"
 

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