A
Alp
Hi Experts,
Back again. I have a query that refuses to proceed when there is an ' in a
text field it needs to process. Any help or guidance to resolve this issue
would be greatly appreciated.
As an example when the field contains A' FAMOSA as its data the query
produces the error:
Syntax error (missing operator) in query expression "A' FAMOSA', ")'
Thanks in advance.
Alp
The code behind the form is:
Private Sub PrintBtn_Click()
On Error GoTo Err_PrintBtn_Click
'Make the entries to nametags table
Dim strSQL As String
'strSQL = "INSERT INTO tb_tags ( tag_co_id, tag_type ) " & _
' "VALUES (" & Forms!fr_nt_unnamed!coid & ", '" &
Forms!fr_nt_unnamed!attTipAd & "' );"
strSQL = "INSERT INTO Attendees ( CompanyID, AttendeeType, CompanyName,
Booth ) " & _
"VALUES (" & Forms!DataEntry!fr_nt_unnamed_emb!coid & ", '" & _
Forms!DataEntry!fr_nt_unnamed_emb!attTipAd & "', '" & _
Forms!DataEntry!fr_nt_unnamed_emb!CoNmSel & "', '" & _
Forms!DataEntry!fr_nt_unnamed_emb!BoothNo & "' );"
For x = 1 To Me.ntadet
DoCmd.RunSQL strSQL
Next x
Dim stDocName As String, stWhere As String
stDocName = "Nametag Z"
stWhere = "[CompanyID] = " & Me.coid '& " AND [NameTagIssued] = No"
DoCmd.OpenReport stDocName, acPreview, , stWhere
Exit_PrintBtn_Click:
Exit Sub
Err_PrintBtn_Click:
MsgBox Err.Description
Resume Exit_PrintBtn_Click
End Sub
Back again. I have a query that refuses to proceed when there is an ' in a
text field it needs to process. Any help or guidance to resolve this issue
would be greatly appreciated.
As an example when the field contains A' FAMOSA as its data the query
produces the error:
Syntax error (missing operator) in query expression "A' FAMOSA', ")'
Thanks in advance.
Alp
The code behind the form is:
Private Sub PrintBtn_Click()
On Error GoTo Err_PrintBtn_Click
'Make the entries to nametags table
Dim strSQL As String
'strSQL = "INSERT INTO tb_tags ( tag_co_id, tag_type ) " & _
' "VALUES (" & Forms!fr_nt_unnamed!coid & ", '" &
Forms!fr_nt_unnamed!attTipAd & "' );"
strSQL = "INSERT INTO Attendees ( CompanyID, AttendeeType, CompanyName,
Booth ) " & _
"VALUES (" & Forms!DataEntry!fr_nt_unnamed_emb!coid & ", '" & _
Forms!DataEntry!fr_nt_unnamed_emb!attTipAd & "', '" & _
Forms!DataEntry!fr_nt_unnamed_emb!CoNmSel & "', '" & _
Forms!DataEntry!fr_nt_unnamed_emb!BoothNo & "' );"
For x = 1 To Me.ntadet
DoCmd.RunSQL strSQL
Next x
Dim stDocName As String, stWhere As String
stDocName = "Nametag Z"
stWhere = "[CompanyID] = " & Me.coid '& " AND [NameTagIssued] = No"
DoCmd.OpenReport stDocName, acPreview, , stWhere
Exit_PrintBtn_Click:
Exit Sub
Err_PrintBtn_Click:
MsgBox Err.Description
Resume Exit_PrintBtn_Click
End Sub