1.11M Members

Need a little tweak to code please help Delete funtion

 
0
 

I sence victory been battling the this code for 2 days now.

the code i have generated is

strsql = "delete from cg_security_user_right where  user_id= " & TextBox1.Text & " role_id=" & TextBox2.Text & ""

it comes up with this error

Syntax error (missing operator) in query expression 'user_id= 2 role_id=1'.

how do i get past this please

Thank yo so much

 
1
 

try:

strsql = "delete from cg_security_user_right where user_id = '" & TextBox1.Text & "' role_id = '" & TextBox2.Text & "'"
 
0
 

no its still coming with the same error :{

 
0
 

im seriously scratching my head i cannot think of the thing it can b any suggestions

 
0
 

Right after the line where you create the query, please add the following

MsgBox(strsql)

and post the results for us to see.

 
0
 

This is a simple Delete query created in Access 2007. I do not believe you need the extra double quote you had in your original post or the single quotes I saw in another unless your user_id and role_id are strings and not integers.

Dim sql As String = "DELETE * FROM [Copy Of tbl_Inventory]" & _
                        "WHERE ((([Copy Of tbl_Inventory].Item_ID)=181));"
You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: