Connecting Tech Pros Worldwide Forums | Help | Site Map

Syntax error in SQL Delete statement

Member
 
Join Date: Oct 2006
Posts: 106
#1: Dec 21 '06
strSQL4 = "DELETE * FROM ExecutiveResponsibilitySecurity WHERE [ExecutiveResponsibility]= '" & Me.ExeResponsibility & "' and [NetworkID] = ' " & Me.UserID & "';"

DoCmd.RunSQL strSQL4

I am trying to delete from a table.


ExecutiveResponsibility and NetworkID are fields in the table ExecutiveResponsibilitySecurity

Me.ExeResponsibility and Me.UserID is the name of my combo box and the list box which holds the items thati want to delete.

can any one tell me what is wrong in this statement
thanks

msquared's Avatar
Administrator
 
Join Date: Aug 2006
Location: Dublin, Ireland
Posts: 10,885
#2: Dec 21 '06

re: Syntax error in SQL Delete statement


strSQL4 = "DELETE * FROM ExecutiveResponsibilitySecurity
WHERE [ExecutiveResponsibility]= '" & Me.ExeResponsibility & "'
and [NetworkID] =" & Me.UserID & ";"

DoCmd.RunSQL strSQL4
[/code]

Assuming NetworkID is a number

Mary
Member
 
Join Date: Oct 2006
Posts: 106
#3: Dec 21 '06

re: Syntax error in SQL Delete statement


Quote:

Originally Posted by mmccarthy

strSQL4 = "DELETE * FROM ExecutiveResponsibilitySecurity
WHERE [ExecutiveResponsibility]= '" & Me.ExeResponsibility & "'
and [NetworkID] =" & Me.UserID & ";"

DoCmd.RunSQL strSQL4
[/code]

Assuming NetworkID is a number

Mary

No Mary it is string, but don't worry it is solved for the moment.
It was just the matter or deleting Me and using the variable that i had those two fields stored in.

Thank you so much for prompt reply
msquared's Avatar
Administrator
 
Join Date: Aug 2006
Location: Dublin, Ireland
Posts: 10,885
#4: Dec 21 '06

re: Syntax error in SQL Delete statement


Quote:

Originally Posted by tara99

No Mary it is string, but don't worry it is solved for the moment.
It was just the matter or deleting Me and using the variable that i had those two fields stored in.

Thank you so much for prompt reply

No problem Tara.

I'm glad you got it sorted. Glad to see you making an effort to answer other posts as well. We'll make an expert out of you yet.

Merry Christmas


Mary
Reply