Q: I am now able to display records from the database and allow the user to search for records. However, I now wish to allow the user to add new records to the database. Is this possible?
A: Yes - this is possible. The following steps should allow you to modify the publication created in the first two tutorials to allow for the addition of new records:
1) Open the example publication with which you have been working throughout the previous two tutorials
2) Add a text input box to the page
3) In the properties of the text input box, select the Text Input tab and click on the "New" button
4) Create a new publication variable named NEWNAME with a default blank text value
5) Click Apply and OK
6) Now repeat steps 2-5 to create two more text input boxes, assigning the first to a new publication variable named NEWAGE (with a default blank text value) and the second to a new publication variable named NEWOCCUPATION (again with a blank text value)
7) Add a button object to the page
8) In the actions for the button, select the Database group of actions
9) Double-click on the Insert New Record action
10) Open the drop-down menu for the DSN field and select the DSN you created in Part 1
11) Open the drop-down menu for the Table field and select 'Table1' from the list provided
12) You should now see all of the fields from the database appear in the grid below the DSN and Table fields
13) Click on the NAME field to highlight it
14) Enable the Variable radio button
15) Now open the drop-down menu for the Variable field and select the NEWNAME variable
16) Click on the AGE field to highlight it
17) Enable the Variable radio button
18) Now open the drop-down menu for the Variable field and select the NEWAGE variable
19) Click on the OCCUPATION field to highlight it
20) Enable the Variable radio button
21) Now open the drop-down menu for the Variable field and select the NEWOCCUPATION variable
22) Click Apply and OK to confirm the changes
23) Now preview the publication
24) Input some values into the three text input boxes (although the search input field should be left blank)
25) Click the button underneath the three input fields to submit the information
To test that the information has been correctly added, simply exit out of preview mode, open your database back into Microsoft Access and view the contents of Table1. The inputted values should now appear as the last record in the table.
For this message Robin Garrett has been thanked by : mackavi
|