Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 170
  • Last Modified:

How do I connect to an Access Database?

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
scotslad
Asked:
scotslad
1 Solution
 
vorlonCommented:
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
 
scotsladAuthor Commented:
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
 
tfwongCommented:
Simple.

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

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now