![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: Jan 2005
Posts: 1
Rep Power: 0
![]() |
How to connect to access database thru vba (would like code fragment)
Sorry I'm new to vb so i'm gonna be asking stupid shit questions. I need to connect to an access database and read the fields. The basic program is to read thru a list of holidays and use it to eliminate hols in a date calc..(calc how much time was taken in a job submitted at date a and completed at date b)
|
|
|
|
|
|
#2 |
|
Expert Programmer
|
There are multiple ways, of doing it, but in the VB way, you just need to use the Data Access control. You can link it directly to an Access 97 database, but this is a bit out of date - if you have Access installed, you should be able to choose ODBC and go at it that way (using the more up to date SQL drivers). If you have anything other than the crippled learning edition, you should have the VisData sample project and code, which should do what you're looking for, though it's a pain to strip out all the rubbish (haven't Microsoft heard of object-oriented modularisation?).
There is a built in "retrieve stuff from database" function, where you go around setting the datasource property on textboxes, grids etc to bind to the control, which is quick though restrictive - I've never seen the point, personally. There is actually a wizard somewhere that'll do it for you, though if you want to do anything more I'd do the data update/retrieval manually. Hope this helps - search through the documentation (walkthrough of the VisData project in your Samples folder should help) or look on MSDN for more information. |
|
|
|
|
|
#3 |
|
Programming Guru
![]() Join Date: Oct 2004
Location: namespace std
Posts: 1,246
Rep Power: 5
![]() |
welcome adityamukherjee...???
long name you got there. anyways, welcome to the forums!
__________________
i put on my robe and wizard hat... Have you ever heard of Plato, Aristotle, Socrates?...Morons. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|