I want to use Excel SQL to query a table in access (I have googled and learned I can do this via DAO or ADO). So this is my SQL statement:
[vba]
"Select possibleFields from FieldsinDatabase;"
[/vba]
This would then return the possible fields that could be in the main database. Ideally, I would like to store all of these fields in one variable if possible, and append them to the end of a seperate SQL string that I would be running. So maybe something like:
[vba]
fieldNames = "Select possibleFields from FieldsinDatabase;"
[/vba]
then append fieldNames to a seperate SQL statement so it would be:
[vba]
"Select ReferreeNum, RefereeFName, RefereeLName, RefereeAddress, RefereePhone," & fieldNames & " from MainDatabase
[/vba]
How can I accomplish this via VBA?