Access and Delphi walkthrough
Part one, setting up the Access database
In the example that follows, I'll be using a simple database of names and test scores.
You can download it here. It's a good idea to work with the simplest possible database so that you can see how the principles work.
You can download it here. It's a good idea to work with the simplest possible database so that you can see how the principles work.
Creating the Access Database
This is what the Access test database looks like. There are two tables, one - named pupils - which has the pupils first name and the test scores.
The second table, called surnames, has the first name and surname data. Finally there's a simple relationship established between the UserName field in the pupils table and the firstname field in the surnames table. Whatever database you use, make sure that you've created the relationships, then save it somewhere that you can easily find it when we load Delphi. Note: In what follows it should be possible to use databases saved either in Access 2007 to 2013 format (.accdb) or in Access 2003 format (.mdb).
However there are some problems with the drivers for the later versions of Access. If you run into difficulty it might mean that you have to use the 2003 format. It's slightly annoying but it will still all work. Part two, setting up the Delphi form |
Guide to linking Access 2010 and Delphi XE3 is here (pdf download)