DELETE FROM a table WHERE...

Joined
Oct 28, 2013
Messages
3
Reaction score
0
Good morning,
I am having a problem creating a DELETE SQL statment in MS Access 2007. What I need to do is delete a project record from entirely in several tables from a dashboard form. I have a "Delete Record" button that I put code to that should delete the current record, but seem to get a "Data MissType" error. Is there somthinf with using the "& that causes it to mess up. All of the field types are TEXT and it shouls work...

Delete command button:
DoCmd.RunSQL "DELETE FROM tblName WHERE [tblName.ProjectID] = " & Me.txtProjectID & ""

My thinking is to grab the project number from the current form's project field txtProjectID and use it in the criteria to delete the same numbered record from several tables. Once I get it to work on one table it should be the same for all and I will just run the DELETE statment agenst each table name...

Any help woill be greatly appreciated.
 
Joined
Oct 28, 2013
Messages
3
Reaction score
0
I found the right way to make it work:

DoCmd.RunSQL "DELETE FROM tblName WHERE [tblName.ProjectID] = txtProjectAFE"

Cheers...
 

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