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

Query Syntax with Characters 1

Status
Not open for further replies.

jt463

IS-IT--Management
Nov 23, 2005
134
I have the following Select statement:

Code:
stSelection = Me.Selection.Value

stSQLWhere = "Subdivision = '" & Me.Subdivision.Value & "' AND Selection = '" & stSelection & "'"

This corrects the issue I had when my Me.Selection.Value was:

Add 10"x50" Double-Hung Windows

However, now I have an issue with the following:

9' Foundation Poor

I solved the 9' issue by changing my select to:

Code:
Set SelNotesRst = SelNotesDb.OpenRecordset("select * from COSelTotalNotes WHERE Subdivision = '" & Me.Subdivision.Value & "' AND Selection = "" & stSelection & """)

But that presents a problem when my value includes quotes.

Any help would be greatly appreciated. Thank you.
 
ac2k or above:[tt]
stSelection = Replace(Me!Selection.Value, "'", "''")
stSQLWhere = "Subdivision='" & Me.Subdivision.Value & "' AND Selection='" & stSelection & "'"[/tt]

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
That worked like a charm! Thank you PH.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top