Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jan 20th, 2005, 1:44 AM   #1
adityamukherjee
Newbie
 
Join Date: Jan 2005
Posts: 1
Rep Power: 0 adityamukherjee is on a distinguished road
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)
adityamukherjee is offline   Reply With Quote
Old Feb 1st, 2005, 3:30 AM   #2
Rory
Expert Programmer
 
Rory's Avatar
 
Join Date: Jan 2005
Location: London
Posts: 542
Rep Power: 4 Rory is on a distinguished road
Send a message via MSN to Rory
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.
Rory is offline   Reply With Quote
Old Feb 1st, 2005, 3:51 AM   #3
bl00dninja
Programming Guru
 
bl00dninja's Avatar
 
Join Date: Oct 2004
Location: namespace std
Posts: 1,246
Rep Power: 5 bl00dninja is on a distinguished road
Wink

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.
bl00dninja is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:33 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC