We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Form close/reopen to filter criteria

pdvsa
pdvsa asked
on
Medium Priority
380 Views
Last Modified: 2012-08-13
Experts,
In the below code I woudl like to know if under the ELSE part I can add something that looks to see if the open form "frmLetterOfCredit_Cont" is already opened to the filter criteria and if so then dont reopen it like it is doing now?  If the form is already open to the filter criteria currently it closes and then reopens and it takes too much time because the network is slow.  

So basically if the form "frmLetterOfCredit_Cont" is already opened to OpenArgs:=Me.ID & ";" & Me.cboEndUserID then dont close it and reopen...just bring that form to the front and if NOT then close and reopen.

Private Sub btnOpenLCForm_Click()

    If CurrentProject.AllForms("frmLetterOfCredit_Cont").IsLoaded = False Then
         DoCmd.OpenForm "frmLetterOfCredit_Cont", , , , , , OpenArgs:=Me.ID & ";" & Me.cboEndUserID
        'Cancel = True
    Else
        DoCmd.Close acForm, "frmLetterOfCredit_Cont"
        DoCmd.OpenForm "frmLetterOfCredit_Cont", , , , , , OpenArgs:=Me.ID & ";" & Me.cboEndUserID

    End If
   
End Sub
Comment
Watch Question

CERTIFIED EXPERT

Commented:
If CurrentProject.AllForms("frmLetterOfCredit_Cont").IsLoaded = False Then
         DoCmd.OpenForm "frmLetterOfCredit_Cont", , , , , , OpenArgs:=Me.ID & ";" & Me.cboEndUserID
        'Cancel = True

elseif forms!frmletterofcredit.someidcontrol= me.id and forms!frmletterofcredit.anotheridcontrol= Me.cboEndUserID then
' do nothing, already correct

Else
        DoCmd.Close acForm, "frmLetterOfCredit_Cont"
        DoCmd.OpenForm "frmLetterOfCredit_Cont", , , , , , OpenArgs:=Me.ID & ";" & Me.cboEndUserID
End If
CERTIFIED EXPERT

Commented:
Obviously you must use your own control names in the above mod.
CERTIFIED EXPERT
Top Expert 2016
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
pdvsaProject finance

Author

Commented:
Cap, that worked perfectly.  I was just about to respond to Peter.

Pdvsa
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.