pdvsa
asked on
Form close/reopen to filter criteria
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("f rmLetterOf Credit_Con t").IsLoad ed = 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
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("f
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
Obviously you must use your own control names in the above mod.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Cap, that worked perfectly. I was just about to respond to Peter.
Pdvsa
Pdvsa
DoCmd.OpenForm "frmLetterOfCredit_Cont", , , , , , OpenArgs:=Me.ID & ";" & Me.cboEndUserID
'Cancel = True
elseif forms!frmletterofcredit.so
' do nothing, already correct
Else
DoCmd.Close acForm, "frmLetterOfCredit_Cont"
DoCmd.OpenForm "frmLetterOfCredit_Cont", , , , , , OpenArgs:=Me.ID & ";" & Me.cboEndUserID
End If