Page 1 of 1

Add Controls to 'Allow Add' form fields using Views

PostPosted: Wed Jan 30, 2013 9:19 pm
by xgis
When using the 'Allow Add' = True feature on table form fields it is possible to add normal controls for data entry. This is especially the case where databound combo or check boxes or radio buttons are used to present multiple selections.
The default 'Add' form that is generated is usually void of controls. These may be populated by default values but do not render like your customised forms generated based on your original table. The 'Allow Add' option also lets you configure which fields are going to be populated when a user adds a new record. This may be done more efficiently through code, although it may also be done without any code.

To do this you need to create a View in SQL or a Query in Access. It is also possible to create a "Custom View" in AspMaker to achieve the same result. The benefit of doing it at the database is that other web or mobile applications can consume data from a database. It is also useful to apply any required filters to the query to ensure you have data displayed and ordered correctly. Fields that are edited after the ADD stage such as (Date Edited Last etc) are not required by the query and may be turned off before generation. A good practice is to order the fields in the query as they appear in the original table form. Then add controls and lookups as required.

If you want to get more advanced and do the same task in a single table hierarchical system where there are multiple parent values that need to be transferred to child records. Filtered radio buttons may be used in conjunction with Add Page 'default values' to show the required ParentID without having to reference it in code. For boolean type fields such as 'RecordActive' they may be set to 1 for Yes and 0 for No etc. For those people developing in Access for SQL it is good to set these values as integers instead of Yes/No fields, which may not be recognised by SQL. Now simply generate and test to ensure you are successfully adding data to your tables, that is also immediately available in your views or queries.