G
Guest
Based on what I've learned on these posts, I've gotten my multiple forms
instances running nicely, and referenced in a collection.
I'd like to ensure that if a user has one instance of a form open with a
particular record in it that they don't open that same record in another
instance. If they choose to open that record again, I'd like to bring up the
instance of the form that already has that record open.
I'm sure this is quite simple to do but I'm completely missing it. I've
created the function below, which inspects the form's caption for my record
key; if found, I'd like to restore it from it's minimized state or bring it
forward from behind wherever it is. But what's the command to do this? I've
managed to give the form focus with .SetFocus, but if the form is minimized
it stays minimized. I want to give it focus and Restore it as well. What am
I missing?
Public Function IssueIsOpen(iIssNo As Double) As Boolean
Dim obj As Object
Dim v As Variant
IssueIsOpen = False
For Each obj In clnForms
v = Split(obj.Caption, ":")
If UBound(v) >= 1 Then
If IsNumeric(v(0)) Then
If iIssNo = CDbl(v(0)) Then
IssueIsOpen = True
obj.SetFocus
Exit For
End If
End If
End If
Next
End Function
instances running nicely, and referenced in a collection.
I'd like to ensure that if a user has one instance of a form open with a
particular record in it that they don't open that same record in another
instance. If they choose to open that record again, I'd like to bring up the
instance of the form that already has that record open.
I'm sure this is quite simple to do but I'm completely missing it. I've
created the function below, which inspects the form's caption for my record
key; if found, I'd like to restore it from it's minimized state or bring it
forward from behind wherever it is. But what's the command to do this? I've
managed to give the form focus with .SetFocus, but if the form is minimized
it stays minimized. I want to give it focus and Restore it as well. What am
I missing?
Public Function IssueIsOpen(iIssNo As Double) As Boolean
Dim obj As Object
Dim v As Variant
IssueIsOpen = False
For Each obj In clnForms
v = Split(obj.Caption, ":")
If UBound(v) >= 1 Then
If IsNumeric(v(0)) Then
If iIssNo = CDbl(v(0)) Then
IssueIsOpen = True
obj.SetFocus
Exit For
End If
End If
End If
Next
End Function