Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21089

[RESOLVED] syntax error in query expression via Sql DataReport

$
0
0
i am trying to show a report of a specific customer
when i hit the buttonreport i see his history only if his name dosnt contain this '
e.x salsa31 this is ok
salsa's room here i get the error when i hit the button report
if it does then i get syntax error
this is the code i am using to show this report
Code:

Private Sub BttnReport_Click()
Set DtrTempPay.DataSource = CN.Execute("SELECT * FROM TempCash WHERE TempCust = '" & FrmDailyCash.LsVw.SelectedItem.SubItems(3) & ("'"))
    DtrTempPay.Show 1
End Sub

this is the function that supposed to bypass this'
Code:

Function RplS(s As String) As String
    RplS = Replace$(s, "'", "''")
End Function

also tried this
Code:

Set DtrTempPay.DataSource = CN.Execute("SELECT * FROM TempCash WHERE TempCust = '" & FrmDailyCash.LsVw.SelectedItem.SubItems(3) & RplS("'"))
i tried everything still get the same error

Viewing all articles
Browse latest Browse all 21089

Trending Articles