| View previous topic :: View next topic |
| Author |
Message |
hreba General User

Joined: 14 Oct 2007 Posts: 14
|
Posted: Sun Oct 14, 2007 11:45 am Post subject: Modify/Search mode of a form |
|
|
Just created my first usable database, it is an addressbook.
It contains a main table with names, phone numbers and so on. One of the fields is for references (keys) to another table which contains cities.
My main form contains a table control which shows some entries of the main table, and a list box for the city of the selected record of the table control/main table. What I can do so far with this form is to modify my main table.
What I would like to do now, is including a check box "Modify" which changes the functionality of the form: if it is checked, the function shall be as described above. If unchecked, modification of the database shall be disabled, and the city listbox shall serve as selector of the records displayed in the table control.
How do I do that? |
|
| Back to top |
|
 |
QuazzieEvil Super User

Joined: 17 Jan 2007 Posts: 599 Location: Houston, TX
|
Posted: Mon Oct 15, 2007 1:57 pm Post subject: |
|
|
here is an example on toggeling the allow delete, insert, and update of a form
| Code: |
Sub toggleFormAccess(Event As Object)
Dim Form As Object
Form=Event.Source.Model.Parent
Form.AllowUpdates=Not(Form.AllowUpdates)
Form.AllowDeletes=Not(Form.AllowDeletes)
Form.AllowInserts=Not(Form.AllowInserts)
Form.reload()
End Sub
|
you can set them all, or just the one you want. you must reload the form for the edits to take effect.
you can save the current row: CurrRow=Form.Row and reset it after the reload: Form.absolute(CurrRow) as you will be taken to the first record whenever you reload.
hope this helps. |
|
| Back to top |
|
 |
hreba General User

Joined: 14 Oct 2007 Posts: 14
|
Posted: Mon Oct 15, 2007 3:56 pm Post subject: |
|
|
| Thanks, will try it. |
|
| Back to top |
|
 |
|