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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sql syntax error 1

Status
Not open for further replies.

byurow

Programmer
Jul 7, 2002
111
US
Hey everyone,

I am obviously missing something with this code, only I can't figure out what it is. On the double click event of my UNBOUND list box, I am trying to delete the record selected. My code is as follows:

Code:
Private Sub LstContracture_DblClick(Cancel As Integer)

Dim sqlDeleteContractureRcd As String
Dim strContractureSite As String
    
Me.CboContractureSite = Me.LstContracture.Column(1)
Me.TxtContractureDegree = Me.LstContracture.Column(2)

strContractureSite = Me.CboContractureSite

DoCmd.SetWarnings False ' Turn warnings messages off while doing delete

    sqlDeleteContractureRcd = "DELETE TempContracture.* FROM TempContracture WHERE TempContracture.ContractureSite = " & strContractureSite
    DoCmd.RunSQL sqlDeleteContractureRcd
    
DoCmd.SetWarnings True

Call FillLstContractureInfoListBox

End Sub

I am getting a run-time error '3075' Syntax error (missing operator) in query expression 'TempContracture.ContractureSite = Left Finger'.

When I debug and hold my curser over strContractureSite it shows the value as "Left Finger", which is the correct record. I get the feeling that, once again, I am missing the obvious. Any help would be most appreciated!
 
Have you tried this ?
sqlDeleteContractureRcd = "DELETE TempContracture.* FROM TempContracture WHERE TempContracture.ContractureSite = '" & strContractureSite & "'"

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Thank you! That worked perfectly! I knew I was missing something simple!

Thanks again!

Brenda
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top