passing a variable to a query

mardi 17 février 2015

Hi all,



I have an outlook macro that checks an email based on a table added at the bottom. In one of the fields there is a BIN nr. I can debug.print it and shows up in the immediate window. Later in the macro, the code will connent to an access database and look for the analyst name inside a table based on the BIN nr to find the correct record. If I add the BIN nr to the code itself, it will find the record and debug print the analyst name:




Code:



SQL = "SELECT [BIN],[Analyst] FROM tbl_case_list WHERE [BIN] = 1234567890"


I would like to know how I could change to use BIN_nr variable that is a text string and pass it to the SQL statement.



Any ideas how to do this?



Greetings.

passing a variable to a query

0 commentaires:

Enregistrer un commentaire

Labels