open form while closing form

cyberpac9

Registered User.
Local time
Yesterday, 23:05
Joined
Jun 6, 2005
Messages
70
this has to be simple but i can't get it to work...

i have a selection form (frmSelection) with a combo box...the user makes a selection from the combo box and based on that selection another form opens when they click next...i have a Select Case under cmdNext_Click()..here's a sample of what that looks like:
Code:
Select Case cboVioCat.Value

Case 1 ' loads frm_vw_lab_all_facility
  frm_Name = "frm_vw_lab_all_facility"
  DoCmd.OpenForm frm_Name, acNormal
Case 2 ' loads frm_vw_lab_all_other
  frm_Name = "frm_vw_lab_all_other"
  DoCmd.OpenForm frm_Name, acNormal
Case Else
  strMsg = "Please make a selection from the list"
  MsgBox strMsg, vbInformation, "Oops!"
  
End Select
now what i'd like to happen is say the user selects the first option "Case 1", the new form opens...this works perfectly...but what i'd also like to happen is frmSelection to close - it is no longer needed...i have added DoCmd.Close within each Case and after the End Select but none work...it appears as though it is closing the new form, frm_vw_lab_all_facility...what am i missing here?
 
Look at the arguments available for DoCmd.Close in VBA Help.
 
i see my mistake....thanks!
 
HTH. As you may have surmised, when you don't specify, it closes the active object, which is the form you just opened.
 

Users who are viewing this thread

Back
Top Bottom