Question

SQL From statement as a variable

  • 12 April 2023
  • 2 replies
  • 89 views

Badge +1

Hello Everyone 

Usually the statement is like: Select * from [sheet1$$] where  etc etc

I need the sheet1 to be a variable, the sheet changes with each excell book I bring in and there are lots

I tried [$SheetNameHere$] that did not work, even when I remove the square brackets.


2 replies

Userlevel 5
Badge +10

@The Automator  what error you are getting ?

Badge +1

The Microsoft Access database engine could not find the object - after the word object in single quotes was the value of the variable then it goes on to say make sure the object exists.

The name it mentions is the correct sheet name, it does successfully open the spreadsheet.

 

Reply