I get the client name from the drop-down list and use this value to query the Excel table, however the name can contain one quote (for example, Adam Meat). This breaks my application and how can I make a request with a variable containing one quote?
Private Sub cboCompany_Change() Dim customerName As String customerName = cboCompany.Value rsT.Open "SELECT Customer, Postcode, Address1, Address2, State, Country FROM Customers WHERE Customer = '" & customerName & "'", cn, adOpenStatic
sql vba ms-word
Morgan
source share