We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,650 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Need a little tweak to code please help Delete funtion

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

4
Contributors
5
Replies
5 Hours
Discussion Span
1 Year Ago
Last Updated
6
Views
Farhan_B
Junior Poster in Training
66 posts since Feb 2012
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

try:

strsql = "delete from cg_security_user_right where user_id = '" & TextBox1.Text & "' role_id = '" & TextBox2.Text & "'"
Mitja Bonca
Posting Maven
2,561 posts since May 2009
Reputation Points: 642
Solved Threads: 486
Skill Endorsements: 15

no its still coming with the same error :{

Farhan_B
Junior Poster in Training
66 posts since Feb 2012
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

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

Farhan_B
Junior Poster in Training
66 posts since Feb 2012
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

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

MsgBox(strsql)

and post the results for us to see.

Reverend Jim
Illigitimae non carborundum
Moderator
3,750 posts since Aug 2010
Reputation Points: 585
Solved Threads: 470
Skill Endorsements: 33

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));"
Phasma
Junior Poster in Training
81 posts since Nov 2008
Reputation Points: 21
Solved Threads: 21
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page generated in 0.1650 seconds using 2.67MB