DoCmd.RunSQL "DELETE * Using Me.Text Box

Vagus14

Registered User.
Local time
Today, 07:57
Joined
May 19, 2014
Messages
66
Hi everyone,

I am trying to get the code below to delete rows with the specific text in Me!Project_Name. I have the code 99% complete, however, the "Enter Parameter box" is poping up and a blank input box. I can input the same text and it'll run but I want to bypass this "Parameter box". Thanks for your help. Code below:

Code:
    DoCmd.RunSQL "DELETE * FROM " _
        & "tblProjectData WHERE [Project Name]=" & Me!Project_Name & ";"

Issue: Parameter Box keeps poping up with the ME!Project_Name text and a box to enter text.

It's probably something real simple I'm missing... Please help out even if it is a simple solution...
 
This doesn't seem to be working either....

Code:
CurrentDb.Execute "DELETE * FROM tblProjectData WHERE [Project Name]=" & Me!Project_Name & ";"


Error I get: Syntax Error (missing operator) in query expression '[Project Name] = '

Can I get some help. It will be much appreciated.
 
Try (untested) --Note: I added 2 single quotes

Code:
CurrentDb.Execute "DELETE * FROM tblProjectData
 WHERE [Project Name]='" & Me!Project_Name & "';", dbFailOnError
 
Last edited:
jdraw... That was it!!

Thanks so much!

CurrentDb.Execute "DELETE * FROM tblProjectData WHERE [Project Name]='" & Me!Project_Name & "';"
 

Users who are viewing this thread

Back
Top Bottom