Examples with DAO and Access97
This gives additional examples using DAO which is compatible with Access 97. The database file is InvenTre.mdb.
This shows the connect to the database which was created in Access 97.
This shows the link of the txtItemNo box to the DataField ItemNo and the DataSource
The link to the database means that the information requested on the form is shown. This slide shows the first record.
I am linking to the InvenTre.mdb database and specifically to the Tee table on that database (recordsource). The connection is to Access.
datTree is the name I gave the Data control that links to the database and ItemNo is the field on that database that I am linking to this field.
As you can see txtMarkup is not linked to any DataSource or any DataField. This is true for the % Mark Up area as well.
When the txtItemNo changes, the information for the next record is calculated. Note that formatting of the text boxes containing price, cost, markup and percent markup is also done.
Code will be continue on slide 10 and 11.
The markup and markup percent are calculated based on cost and price using the calculations shown in the previous slide.
SelStart is a property that can set the starting point of the selected text - it can also be used to return the starting point.
SelLength is a property that returns or sets the number of characters that are selected.
From Microsoft Visual Basic Help
When text price looses focus, the markup and the markup percent are recalculated. The change in price will show on the database.
Note that the change in price that was made on the previous slide shows in the database.
Please note that this form is linked to the database and the text boxes are linked to the database in the same way as shown on previous slides in this presentation.
On the previous slide, I started to search for Elm. This shows the successful retrieval of the tree named elm.
This shows the code to add a record, delete a record, exit, move to the first record and move to the last record. More code is shown on the next slide.
This shows move next and move previous with code to make sure that I do not go outside the range of the file.
This code also shows the code for doing a search to find a record that matches the name entered.