Board index » delphi » using delphi to create ms access tables

using delphi to create ms access tables

my first submission-hope this is right group for this-don't flame
me too bad.
i have a form with 2 buttons, 2 tables, 2 data source .
using p120,win 95, 64mb, delphi 2,bde conf util s3.0 and think
bde is 4.51
configure utility has as msaccess driver(blanks if not listed
here)
version 1.0
type      server
dll32    idda3532.dll
database name c:\guide\testaccess
open mode is  read\write
alias testaccess has
type    msaccess
path   c:\guide\testaccess
databasename testaccess
open mode read\write
lang driver access general
the crete table for paradox and access uses defaults except as
noted in the source code hereunder.. creation of paradox tables
works great..  access part  stops at
rasied eception class edbengine error with message 'file does not
exist.  couldn't find file 'testaccess'. alias.
alias:testaccess'. precess stopped. use step run etc.

WHAT AM I DOING WRONG?
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls,
Forms, Dialogs,
  StdCtrls, DB, DBTables;
type
  TForm1 = class(TForm)
    btnBuildParadox: TButton;
    Button2: TButton;
    dsPdox: TDataSource;
    tblPdox: TTable;
    dsAccess: TDataSource;
    tblAccess: TTable;
    btnTestAccess: TButton;
    procedure btnBuildParadoxClick(Sender: TObject);
    procedure btnTestAccessClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.btnBuildParadoxClick(Sender: TObject);
begin
begin
with tblPdox do
begin
Active := false;
DatabaseName := 'testpdox';
TableName := 'district';
//'TableType := ttparadox;   not needed using ttdefault for
database
with tblPdox.fielddefs do
begin
clear;
add ('AuditDistrict',ftstring,1,True);
add ('RunNumber', ftInteger,0,false);
add ('Auditkey',ftinteger,0,false);
add ('CountyString',ftstring,40,false);
end;
tblPdox.createtable;
if tblPdox.active then tblPdox.close;
end;
end;
end;
procedure TForm1.btnTestAccessClick(Sender: TObject);
begin
begin
with tblAccess do
begin
Active := false;
DatabaseName := 'testAccess';
TableName := 'district';
with tblAccess.fielddefs do
begin
clear;
add ('AuditDistrict',ftstring,1,True);
add ('RunNumber', ftInteger,0,false);
add ('Auditkey',ftinteger,0,false);
add ('CountyString',ftstring,40,false);
end;
tblAccess.createtable;
if tblAccess.active then tblAccess.close;
end;
end;
end;
end.

 

Re:using delphi to create ms access tables


Make sure it is BDE 4.51. Look at time stamp.

As for the driver configuration:
   (1) database name should be blank. You don't assign database names in
the driver.

Now for the alias named 'TESTACCESS'
   (1) the path should have the .mdb extension e.g. c:\guide\test.mdb
   (2) leave the langdriver field blank

Drop a TTable component on your form. In the Object Inspector, click on
database name and select your new alias 'TESTACCESS' from the drop down
list. In the Object Inspector, click on the tablename field. A password
dialog box will pop up. Just leave everything blank and click on OK. You
will then get a drop down list of all the tables in the database.

On Thu, 02 Jul 1998 16:45:39 -0400 Newman Gentry said something like...
: my first submission-hope this is right group for this-don't flame
: me too bad.
: i have a form with 2 buttons, 2 tables, 2 data source .
: using p120,win 95, 64mb, delphi 2,bde conf util s3.0 and think
: bde is 4.51
: configure utility has as msaccess driver(blanks if not listed
: here)
: version 1.0
: type      server
: dll32    idda3532.dll
: database name c:\guide\testaccess
: open mode is  read\write
: alias testaccess has
: type    msaccess
: path   c:\guide\testaccess
: databasename testaccess
: open mode read\write
: lang driver access general
: the crete table for paradox and access uses defaults except as
: noted in the source code hereunder.. creation of paradox tables
: works great..  access part  stops at
: rasied eception class edbengine error with message 'file does not
: exist.  couldn't find file 'testaccess'. alias.
: alias:testaccess'. precess stopped. use step run etc.
:

Other Threads