UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
> Combobox, Access 2013    
 
   
fogline
post May 21 2020, 08:35 AM
Post#1



Posts: 229
Joined: 5-August 15
From: Ringgold, GA. USA


I have an Category Combo Box to to find records on a form
all of my combo box Categories work just fine
But I have one Category that has an Apostrophe in it like -> Ray's
If I pick it then I get an error and it cant find the record
If I change that Category name to -> Rays
Then it works.

Here is my SQL for the combo box. I know I just need to add something so the Apostrophe will not throw an error.

Private Sub Combo3_AfterUpdate()

Dim strSQL As String
Dim strSQLSF As String


strSQL = "SELECT DISTINCT tblDocPDF.Category FROM tblDocPDF "
strSQL = strSQL & " WHERE tblDocPDF.Category = '" & CatCombo3 & "'"
strSQL = strSQL & " ORDER BY tblDocPDF.Category;"


strSQLSF = "SELECT * FROM tblDocPDF "
strSQLSF = strSQLSF & " WHERE tblDocPDF.Category = '" & CatCombo3 & "'"


Me.RecordSource = strSQLSF
Me.Requery
End Sub

--------------------
Ray White - Fog Line Software LLC.
Email
Go to the top of the page
 

Posts in this topic



Custom Search


RSSSearch   Top   Lo-Fi    9th July 2020 - 12:14 PM