SQL delete code

What would the VBA code be to delete a specific record from a table?

Something like:

Delete * from tblName where Client= me.txtclientID

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongCommented:
you need to use ADO object library, apparently an ADODB.Connection object, and then use it to connect to your database with a valid connection string, and then using this object's Execute method to execute the Delete SQL statement you wish to be executed.
Ryan ChongCommented:
SteveL13Author Commented:
Sorry.  Not following.  Do not know how to write the code.
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Rey Obrero (Capricorn1)Commented:
try this

if clientid is Number

currentdb.execute "delete * from tblName where Client=" &  me.txtclientID

if clientid is Text

currentdb.execute "delete * from tblName where Client='" &  me.txtclientID & "'"

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SteveL13Author Commented:
Here is my query designer SQL:

DELETE tblClient.*, tblClient.ClientID
FROM tblClient
WHERE (((tblClient.ClientID)=[Forms]![frmClients]![txtClientID]));

How do I convert that to VBA code?
SteveL13Author Commented:

Thank you.  You posted the solution just as I was posting my last reply.

It is number and your solution worked perfectly.  I wish there was a guide somewhere to assist in writing simple SQL code like this.
The default library for Access is DAO not ADO.  DAO is optimized for working with Jet/ACE so there is no reason to use ADO.  As for other RDBMS', I haven't seen any analysis comparing DAO and ADO using the ACE library so I can't say which is better.  All the analysis that I find is for Jet and Jet has been gone since 2007.
Ryan ChongCommented:
>>The default library for Access is DAO not ADO
Ok, not aware this was in Access TA.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.