Please Help with this RunSQL Command

eforce

Registered User.
Local time
Yesterday, 17:29
Joined
Mar 25, 2002
Messages
44
I have this code behind a delete current record cmdbutton:

DoCmd.RunSQL "Delete from tblMinistryII Where recid = " & Forms![MINISTRY I & II FORM]!RECID & ";"

When I press this button I keep getting a parameter box that pops up.

I want to delete the current record in my form. The RECID in my table has the same data as my forms RECID textbox.

The RECID in my table is updated with data from three textboxes on my form (concatenated). I have a RECID textbox on my form which has the control source for RECID in my tblMinistryII table.

Please help!
 
You don't say what your prompt is, I presume it's looking for [MINISTRY I & II FORM] which is probably mispelled.

I suggest that your use the QBE frame to build your query and then convert it to SQL and finally compare that to what you're using.
 
eforce,

For future SQL string building, see llk's response. For now, assuming recid is a number, you can try this:
Code:
	Dim strSQL as string

	strSQL = "DELETE * FROM tblMinistryII " & _
		 "WHERE recid =" & [Forms]![MINISTRY I & II FORM].[RECID]

	DoCmd.RunSQL strSQL
If that doesn't work, see llk's response yet again...

Regards,
Tim
 
Good eye pono1, I missed the missing *.
 

Users who are viewing this thread

Back
Top Bottom