Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete record matching form value 1

Status
Not open for further replies.

omooreirl

Technical User
Oct 28, 2008
11
DE
Hi

I have a form in which the use enters a batch number. On clicking Continue, the table is referenced to see whether the value exists or not. If it does then the user has the option to delete the row in the table.

The code I am using for the delete query is as follows:
DoCmd.RunSQL Delete tblStoredBatches.TempBatchID FROM tblStoredBatches WHERE (tblStoredBatches.TempBatchID) = 1d2222

Can anyone help?

OM
 
Apologies - just to clarify:
Tempbatchid is the table field that I am checking to see whether the form value against. The form value is also called tempbatchID:
DoCmd.RunSQL Delete tblStoredBatches.TempBatchID FROM tblStoredBatches WHERE (tblStoredBatches.TempBatchID) = Me.TempBatchID.Value

OM
 
DoCmd.RunSQL Delete tblStoredBatches.TempBatchID FROM tblStoredBatches WHERE (tblStoredBatches.TempBatchID) = Me.TempBatchID.Value

is this how its formated in the vba editor?

do you get any masseges, is it running at all?

where do you have the problem?

if its only the formating then try
Code:
docmd.excute("DELETE tblStoredBatches.TempBatchID FROM tblStoredBatches WHERE tblStoredBarches.TempBatchID = '" & Me.TempBatchID & "'")

didnt try it so i hope it works

Joe
 
I'd try this:
Code:
DoCmd.RunSQL "DELETE * FROM tblStoredBatches WHERE TempBatchID='" & Me!TempBatchID & "'"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks guys.

I'll go with PHV's solution as it was what I was trying to do in the first place.

Thanks again.

OM
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top