Bon Vivant
11-02-2011, 11:09 AM
G'day
I'm new to VBA - so please bear with me.
Set up:
I have an EXCEL file where in Column A contains a date
Column B would have the following text: "Click here for RAW data"
Example:
A _____________B
1/1/2011 _______Click here for RAW data
2/1/2011 _______Click here for RAW data
3/1/2011 _______Click here for RAW data
I would like to offer my customer the feature that when they click on cell B1 or B2 or B3
that a macro is engaged where:
- the date in the corresponding A cell is passed to a database query and used as part of the selection criteria
- That a new EXCEL worksheet is opened with the RAW data included.
The data base is a SYBASE - I got the connection syntax figured out
I need figure out:
- How to pass a parameter ( corresponding A cell)
- How to excute query
- How to open new worksheet with query results.
Connection syntax:
sConnect = "Driver={SYBASE ASE ODBC Driver};Srvr=xx.xx.xx.xx;Uid=user;Pwd=password;"
sSQL = "SELECT * From Customer WHERE (Customer.Date =Value from corresponding A cell"
Cheers & Thanx
I'm new to VBA - so please bear with me.
Set up:
I have an EXCEL file where in Column A contains a date
Column B would have the following text: "Click here for RAW data"
Example:
A _____________B
1/1/2011 _______Click here for RAW data
2/1/2011 _______Click here for RAW data
3/1/2011 _______Click here for RAW data
I would like to offer my customer the feature that when they click on cell B1 or B2 or B3
that a macro is engaged where:
- the date in the corresponding A cell is passed to a database query and used as part of the selection criteria
- That a new EXCEL worksheet is opened with the RAW data included.
The data base is a SYBASE - I got the connection syntax figured out
I need figure out:
- How to pass a parameter ( corresponding A cell)
- How to excute query
- How to open new worksheet with query results.
Connection syntax:
sConnect = "Driver={SYBASE ASE ODBC Driver};Srvr=xx.xx.xx.xx;Uid=user;Pwd=password;"
sSQL = "SELECT * From Customer WHERE (Customer.Date =Value from corresponding A cell"
Cheers & Thanx