Help! (jk) forms open in 2 different places, close differently too?

misscrf

Registered User.
Local time
Today, 00:25
Joined
Nov 1, 2004
Messages
158
I have an entry form for a candidate database. There are many combos that control things like types and listings that involve information for the candidate. For all of these types, I have a maintenance form for each of them. In the entry form, where ever a type has a combo, that combo has code in the notinlist event. The code pops a message if the user types something not in the list. That code is above, and explained.

Now, I have made it so that if a user wants to directly maintain a type they do it not from the candidate entry, with buttons by the combo boxes. Instead they only get that message if there is a problem on the entry form. Other than that, from the main menu, they can click a button to take them to a maintenance menu. This has a button to open each type's mainenance form.

My issue has been this:

The user might trigger opening the maintentance form 2 different ways. 1 would be during not in list while on the entry form. In this instance, on the click to close the type maintenance form, the candidate entry form is still open in the background.

I want it that way.

If the user opens the type maintenance form from the maintenance menu, I have the maintenance menu closed, because it would look messy to keep it open at this time. This is where my delema is. There is a close form button on each type's maintenance form, but if it closes from the entry method, it should just close. If it closes from the maintenance form method, I need the maintenace form to open up again.

does that make any sense?

I thought of making the button have an if then else statement that would evaluate if the candidate entry form was open. This is the code that I have, but it is not working. can someone please help? (this is for one specific type, address type. It deals with it's maintenance form and maintenance form's command button)
----

Private Sub cmdCloseAddressType_Click()
On Error GoTo Err_CloseAddressType_Click

Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmMaintenance"

If Forms!frmCandidateEntry.IsLoaded Then
DoCmd.Close acForm, "frmAddressType", acSaveYes

Else:
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "frmAddressType", acSaveYes

End If
Exit_CloseAddressType_Click:
Exit Sub

Err_CloseAddressType_Click:
MsgBox Err.Description
Resume Exit_CloseAddressType_Click

End Sub
-----

Thank you very much. :eek:
 
Last edited:
Resolved on another site with:

If CurrentProject.AllForms("frmCandidateEntry").IsLoaded Then
 

Users who are viewing this thread

Back
Top Bottom