Question

Unable to use variable when connecting to database

  • 2 February 2022
  • 6 replies
  • 3 views

it seems I am unable to include variables (red box) while connecting to a database within a loop. Anyone have a work around?

 

SQL Loop 

msg box file path displayed below

 

FILE PATH DISPLAY


6 replies

Userlevel 3
Badge +7

Hi @Steven chev​ ,

 

Could you try displaying that filepath in a message box, just to see if there are any issues with it?

 

Kind Regards,

Ashwin A.K

Userlevel 5
Badge +9

Hi @Steven chev​ ,

 

We can use the variables, as Ashwin suggested can you check the path in a message box and let us know the result?

Hi @ChanduMohammad S​ 

 

Thanks for chiming in. I have uploaded the results in the post above.

Hi @Ashwin A.K​ 

 

Thank you for you response.

 

I have uploaded the photo of the message box to this thread

 

It looks only 1/3 of the variables are displayed in the msg box. The $Filename$.$Extension$ are the two that are not displayed.

 

Any suggestions?

 

msg box 

see below of error message when running line 2

 

error msg

Userlevel 3
Badge +7

Hi @Steven chev​ ,

 

Could you verify whether the folder which you are iterating through contains files other that the excel files you wish to interact with?

 

Try this, add an If Command and only connect to Excel if the $Extension$ = xlsx.

That ought to do the trick.

 

Kind Regards,

Ashwin A.K

Userlevel 5
Badge +9

Hi @Steven chev​ ,

 

This is the issue, check why the values are not getting passed correctly to this variable you will get connected to the Database.

Reply