|
-
Jan 28th, 2003, 04:29 PM
#1
Thread Starter
Hyperactive Member
stop form from being opened again if opened
I know that this works for the complete app to stop a duplicate app from running
If App.PrevInstance = True Then
End
End If
How can I modify this code to not allow a form from being opened more than once at the same time.
Thanks for your help
-
Jan 28th, 2003, 04:30 PM
#2
Let me in ..
Form does not open twice unless you wish to open.
Simply saying form1.show twice will not open the form1 twice.
-
Jan 28th, 2003, 04:42 PM
#3
Thread Starter
Hyperactive Member
well it is a bit more complicated than that in my app.
I have a full screen mainform from that I have solved the user from minimizing it and opening another by the code shown in the original post.
However the main form allows the user to open a claim "record" and if he trys he can open a second claim "record" which actually gets really messed up and intermingled with the first. So I'm trying to prevent the user from opening a second record while the first is still open by not allowing the form containing the record to be opened a second time.
Hope that makes some sense of my mess.
Thanks for the help
-
Jan 28th, 2003, 05:26 PM
#4
PowerPoster
I dont understand exactly but you would loop thru the forms and see if the one yer talking about is open and if it is then dont open another one. heres a function to use.. Put the function in a Bas or in your form
VB Code:
Function IsFrmOpen(FrmName As String) As Boolean
Dim ofrm As Form
For Each ofrm In Forms
If ofrm.Name = FrmName Then
IsFrmOpen = True
Exit For
End If
Next ofrm
End Function
then to use it just go like this..
VB Code:
If IsFrmOpen("Form2") Then MsgBox "It's open"
Last edited by Arc; Jan 28th, 2003 at 05:33 PM.
-We have enough youth. How about a fountain of "Smart"?
-If you can read this, thank a teacher....and since it's in English, thank a soldier.

-
Jan 28th, 2003, 05:30 PM
#5
Thread Starter
Hyperactive Member
Thanks for the help Arc
I will give that a try.
Thanks again for the help
-
Jan 28th, 2003, 07:00 PM
#6
Let me in ..
If you really do not want user to open the 2nd record while the 1st is open, you should be opening the form in modal mode.
form1.show vbmodal is the syntax. That will prevent the re-opening of form cause it will force the user to close the 1st one before opening 2nd.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|