15. december 2007 - 18:38Der er
7 kommentarer og 1 løsning
Is Find file open?
When I close my db I want to check if the Find File dialog is open and if so it should close it before the db closes. It has happend that I, by mistake has opend 2 dialogs and has not been aware of that one is still open when I closed th db, with the result that Access stops working. A good pice of kode, anyone?
I think the easiest method is to make the form which you use to open the dialog box modal, so that you cant close the datbase until you first close the form.
Have a Public variable in the form for example
Public dialogOpen as Boolean
In the form open event set this to False
In the code which opens the dialog you need to set the variable to True just before you open and False just after you close.
In the form unload you have some code similar to this
if DialogOpen Then
MsgBox "Close the dialog ...." Cancel = True
End If
There is maybe some code which you can use to automatically close dialog but I havent found it yet
Hi Terry! How do I get it to work? I have "Public dialogOpen as Bolean" as a declaration. I have "Set dialogOpen = False" in the open event. I get a compile error that says that it needs an Object. What's wrong?
why do you allow more than one to be opened? You could disable the button which you use to open the dialog and then enable again at the same time you set dialogOpen. And actually if you did that you could use the status of the button instead of dialogOpen varaible.
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.