Form Can't Paste Values with Special Characters Through SQL
Posted on 2007-03-20
Hey guys, I have an access database. There is a form that users use to input data. A SQL query then pastes the data from the form into a table. Unfortunately, if the user inputs parenthesis, single quotes, and other special characters, the SQL gets confused. Can I somehow reformat my SQL statement to take these values and allow the entry of special characters? The "Me.cboDescription.Value" is what can't handle the single quotes and other things. It's not a huge deal, but users are getting debug errors when they use quotes or parenthesis and don't understand why.
If MsgBox("Are you sure you want to add this information?", vbOKCancel) = vbOK Then
AppSQL = "INSERT INTO tblNonRateStep (project_id, step_num, step_desc, step_owner, step_date, step_status) VALUES ('" & Me.id.Value & "','" & Me.cboStep.Value & "','" & Me.cboDescription.Value & "','" & Me.cboOwner.Value & "','" & Me.cboDate.Value & "','" & Me.cboStatus.Value & "')"