Quotation marks in VBA
double-quotes, vba
Solution
This:
comboService = """ & Me.Combo8.Value & """
is what you posted, but you need to add an extra quotation mark in order to add a literal quotation mark:
comboService = """" & Me.Combo8.Value & """"
Double-quotes within a string are what you are looking for.
aVar = "This: "" is a literal quotation mark"
Problem
In my current VBA code, I have a query in which I am using `Chr(34)` to put quotation marks between some of my variables. I was wondering what alternatives exist to this. This is a simple question, i know, but I haven't had any success with repeating quotation marks like this `"` & variable string here & `"` My code is messy for one and not understandable for people who are not familiar with VBA: ``` comboService = Chr(34) & Me.Combo8.Value & Chr(34) ``` Also, this hasn't worked: ``` comboService = """" & Me.Combo8.Value & """" ``` Can you perhaps tell me why? Thanks in advance.