One form open: need to lock down the rest

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello:

I have several forms mapped to a single table. There is a switchboard
running the forms.

I want to make sure that users do not have more than one form open while
entering the data, in order to avoid data error problems.

I'm looking for some basic code that will allow me to lock down all other
forms (which I can specify in the code) while the current form is open.

I.e. in pseudo-code this would be

Start
Form ORDERS opens
Form ADDRESS open property is switched to locked
Form ORDER HISTORY open property is switched to locked
Form ORDERS is closed
Form ADDRESS open property is switched to unlocked
Form ORDER HISTORY open property is switched to unlocked
Stop

Does anyone know if I can find some code somewhere that I could adopt for
this purpose?

Thanks,
pepe

PS: the database is going well so far, thanks for all your help MVPs!!
 
You would do that in the open event of the Orders form. You could use a
combination of...

Opening the form in Dialog mode so that no other forms are available (or
setting properties so that they're read only if you want to be able to get
at Address).
Using the IsLoaded function (in the Northwind sample db) to figure out if
other forms are opening, and then closing them (or just tell them to close
and catch any errors if they weren't open in the first place)
Requery other open forms after you've edited in Orders so that they are
synchronised.
 
Back
Top