Though earlier I have worked on VB + sql, i am
new to VBA. Macro in an Excel file, need to
read data from source excel file based on some
criteria and write to output excel file.
Opened SourceFile using ADODB connection
and recordset and SQL Query
Giving sample scene -
Source file (Name, Age, CityCode).
Criteria Age <=50.
Output file currently (Name, age, citycode)
Sql = "Select Name, Age, CityCode From
SourceFile Where Age <= 50 Order By
CityCode"
This is working fine.
Would like to get CityName from CityMaster
(CityCode, CityName) and update OutputFile
with Name, Age, CityName (instead of
CityCode),
SQL = Select SourceFile.Name, SourceFile.Age,
CityMaster.CityName From SoureceFile,
CityMaster Where SourceFile.CityCode =
CityMaster.CityCode And SourceFile.Age <= 50
Order By CityCode"
This is shown error on SQL.
Request you to guide - should I open
CityMaster also along with Sourcefile to run the
above query. How to keep 2 excel files open
Need guidance and request you to provide the
code for runnng this query on VBA.
- Siva
skumar.ss@gmail.com
new to VBA. Macro in an Excel file, need to
read data from source excel file based on some
criteria and write to output excel file.
Opened SourceFile using ADODB connection
and recordset and SQL Query
Giving sample scene -
Source file (Name, Age, CityCode).
Criteria Age <=50.
Output file currently (Name, age, citycode)
Sql = "Select Name, Age, CityCode From
SourceFile Where Age <= 50 Order By
CityCode"
This is working fine.
Would like to get CityName from CityMaster
(CityCode, CityName) and update OutputFile
with Name, Age, CityName (instead of
CityCode),
SQL = Select SourceFile.Name, SourceFile.Age,
CityMaster.CityName From SoureceFile,
CityMaster Where SourceFile.CityCode =
CityMaster.CityCode And SourceFile.Age <= 50
Order By CityCode"
This is shown error on SQL.
Request you to guide - should I open
CityMaster also along with Sourcefile to run the
above query. How to keep 2 excel files open
Need guidance and request you to provide the
code for runnng this query on VBA.
- Siva
skumar.ss@gmail.com