Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ODBC & Access 1

Status
Not open for further replies.

BenUK

Technical User
Oct 30, 2001
58
US
Currently, I'm importing whole tables via ODBC into Access, I'd like to know how I select only certain records to be returned.
Please be gentle I'm fairly new to ODBC!
 
Where are you importing the table from...i.e. Excel, oracle, DB2...Text file..?
 
I'm importing from an Informix DB using an OpenLink ODBC driver, my process is basically:

Open Access
File>Get External Data>Import...
Select ODBC Database()
Select the File Data Source
Select the relevent Table(s)

If possible I would like not to return the whole table but return only the records that have todays date in the "row_date" field.

Many thanks for your help
Ben
 
I'm not sure how to do that...maybe try posting your question in the Access Forum, however insteading of importing the data, why don't you link the table(
Open Access
File>Get External Data>Link Table...
Select ODBC Database()
Select the File Data Source
Select the relevent Table(s))
to Access, and then create a query in Access to get the Data you want. (to query will run against the Data in Informix)

Another option could be to create some VBA code to connects to Informix DB and then queries the DB and insert the Result set into Access.

for example...I have a Oracle DB, however I need to import some reporting data into Access.. So when I click a button (Create Monthly Report) it performs the following.

1. Connects via odbc to Oracle
2. Runs a Select queries against the oracle tables
3. inserts the data into the Access table
4. produces report.

 
Linking the tables and querying the link is far quicker than the import process I had, thanks for taking the time to look at this.

Could I ask how you connect via ODBC using code? Do you use ADO?

Ben
 
If it were my application I think I'd:
(1) Link (rather than import) the tables
(2) Have a query with a condition date = now() or today() or whatever it is
(3) Run the query only when you want it
Remember you can run queries on queries so you don't have to do it all in one step (so if you want a cross-tab query you can do this too)

Does anyone know if you can link to more than one ODBC source at a time? I'm using Sybase and if you connect to tables in different databases the access system gets its knickers in a twist. I suspect this has to do with ODBC.ini but I'm not sure
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top