Skip to main content

Client.OpenDatabase

Hello,
I'm new here and looking for an easy wildcard (hopefully the right term in English) in the database-name.
At the ? below It's not working with % or * or $ of "?" and I want to make one script for all years.
 
Part of the code:
------------------------------------------------------------------------------------
Dim pad As String
Dim reg As String  
Dim db As Object
Dim dbName As String
pad         = Client.WorkingDirectory   
Set db = Client.OpenDatabase ("SRT" & ? & "_financial_table.IMD")
and so on------------------------------------------------------------------------------------
There are 3 posible databases, each in a different folder:
* \Finance\SRT\2011\ SRT2011_financial_table.imd
* \Finance\SRT\2012\ SRT2012_financial_table.imd
* \Finance\SRT\2013\ SRT2013_financial_table.imd
Byhteway, I use IDEA 8.
Sorry for my English, but it is hard to translate into English jargon.

MagiBzh Tue, 07/28/2015 - 03:42

Hi brian,
I tried your script but I am stuck. How do I define the database for the extractions ? ^^
I will make another post for the field names, I have more questions.

Brian Element Tue, 07/28/2015 - 07:28

You can use something like this to get the filename.  IDEAScript has a function called Client.CommonDialogs that allows you to access the common dailogs, this code will access the file explorer and return the filename that the user has selected.  In this case the variable filename will hold the name of the selected file.

Sub Main

 ' Declare variables and objects.
 Dim filename As String
 Dim obj As Object
 
 ' Access the CommomDialogs object
 Set obj = Client.CommonDialogs
 
 ' Open the File Explorer dialog box.
 filename = obj.FileExplorer()
 
 ' Display the selected file name.
 MsgBox filename
 
 ' Open the selected database.
 Client.OpenDatabase(filename)
 
 ' Clear the memory.
 Set obj = Nothing

End Sub