简体   繁体   中英

How to create a universal MS Access form?

I have a database that has a two tables which differ only in several fields so I thought of creating a single form for them and adding an option group (radio switch) witch would determine to which table the data from fields should go. The thing i I dont know how to hange the destination and some field should be hidden or at least on one but not another option.

This gave me an idea that for small databases this could be used to create universal form.

How to control data destination from form field in MS Access depending on option goup?

You can call different tables based on variables you create in a blank form. Here's an example if you use the table name in a combo box.

Dim var as String
Dim myR as Recordset

var = me.combo_box_name.column(0)

Set myR = CurrentDb.OpenRecordset (var, dbOpenDynaset)

'Code here based on variable, use an if statement if you want

Set myR = Nothing

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM