Using
Access Database Data With dQuery
Using Access databases present special issues. Here we will connect
to the CustomerList Database included in the dQuery Samples.
1. Click the ‘Create a database connection’ Wizard
button in the Wizard Driven Tool Panel area.
2. Choose ‘Create a connection.’ Next.
3. Select type: ‘Access (2000 and above).’ Next.
4. Give your database connection a name. In this case we named it,
“AccessCustomersList.” Next.
5. Choose ‘Create a New DSN.’ Next.
6. Click the ‘open’ folder and find ‘C:\......dQuerySamples\CustomerList.mdb.’Next.
7. Finish!
In the ‘Drag and Drop’ Area, as well as on the Sales.dmd
Design Surface, you will see a new database called ‘AccessCustomersList’(or
your chosen database name). To add the table from this database
click the + sign next to this Database in the ‘Drag &
Drop’ area. Then Double click (or drag to design surface)
CustomerList. You will now see a new table on the design surface
called ‘CustomersList1’.
From here you can do many things. You can view or run reports on
this data. Or, to add these customers to the original Customers1
Table do the following :
1. With Customers2 highlighted, (this is important)
2. Click the ‘Export Wizard’ Icon in the Toolbar menu.
3. Select ‘Current Query.’ Next.
4. Select ‘Add to an Existing database table.’ Next.
5. Choose dQuerySamples. Next.
6. Choose customers. Next. Here source and destination
files should all be lined up.
7. Before you continue you will have to remove the ‘CustomerNo’
field from the ‘Mapped Fields’
list. (‘CustomerNo’ field is an Autoincrement
field in the Table Customers1. You will get an error if this
is still here). Next.
8. Finish.
You will notice that all 3 rows that were in the Access table are
now in the dQuery Customers Table (Customers1). At this point if
you wish to delete it from the Sales.dmd DataModule, click the red
X in the upper right hand corner of the Customers2 Table.
****NOTE: When using an Access table as the Child (Detail) Table,
always set an Index link. If you do not have an Indexed link, the
Parent / Child (Master / Detail) connection cannot be made. The
Access Child data will show the entire Table rather than the data
associated with the link.
|