Solved

How do I connect to an Access Database?

Posted on 1997-05-19
3
160 Views
Last Modified: 2010-04-04
I am new to Delphi and am having trouble connecting to my access database :
"d:\Clients\Property_Guide\Software\property.mdb".

I have used the BDE and created a new driver called ODBC_Access and selected the Access driver as the default.
I set the database name to the path and db name above.
I then create an alias called property with an alias type of
ODBC_Access. I fill in the database name as "property.mdb" and the path as "d:\Clients\Property_Guide\Software" for the alias. When I go into Delphi 2 and try to connect my TTable component, I manage to set the DatabaseName property to "Property", but when I try to set the TableName property
It comes up and asks me for a user name and password, which it shouldn't do.

I'm not sure where I'm going wrong so any help will be appreciated. Thanks in advance.
0
Comment
Question by:scotslad
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 2

Accepted Solution

by:
vorlon earned 50 total points
ID: 1336490
Try this:
When creating a new OBDB driver, select Access 2.0 for MS Office instead of Access Data or Access Files. Then, proceed as usual. It should work...

Hope this helps.
0
 

Author Comment

by:scotslad
ID: 1336491
There is no option to select "Access 2.0 for MS Office" in Delphi 2. This option is in Delphi 1 but not Delphi 2. In the file "Odbcinst.ini" there is an entry for "Access 2.0 for MS Office (*.mdb)" however this option doesn't appear in the list of options when you create a new ODBC driver. The options that appear are all 32 bit. If it is possible to get the option appearing in this list then let me know how to do it. Basically I need a step by step guide to connecting to an access database from within Delphi. For all I know I am missing a stage out or not filling the correct values in the appropriate fields or something. Cheers.
0
 

Expert Comment

by:tfwong
ID: 1336492
Simple.

Just add the 'Database' Component from Data Access page to your form and set 'LoginPrompt' to False.
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question