J
John E.
Sue,
I have made use of the approach you describe in section 18.3.1 of your book
in the code contained in all of our custom forms to prevent the user from
in-cell editing. It works for that purpose but as a result we are seeing
another anomaly in our folder based application which I cannot figure out how
to resolve.
Whenever we save an item by the "Save and Close" button, we can reopen it
normally and edit and save it again by the button. However, if we edit the
item after opening and then do a Save from the main menu and then later
attempt a Close from the menu, it pompts whether you want to save the item
and if you say Yes, it hangs up in the Write() function and displays the
Msgox "Please open the item to make changes" per your listing 18.12 in your
book. This doesn't make sense since the item is already open and also
indicates that somehow the variable m_blnOpenInsp is changing to False during
the Item_Write() or it wouldn't get to the MsgBox in the If statement. If
we also make some edits in the open item and then click the X box on upper
right of item form to create the close prompt that asks whether we want to
save the item or not, the same type of thing happens If you answer YES, it
gives the same MsgBox prompt and you can't save it...you HAVE to click the
close button and answer the prompt as NO without saving.
In either case, after you see the MsgBox prompt if you try to use the "Save
and Close" button the same thing happens and you HAVE to say NO to the prompt
and you can't salvage any of the edits you made.
Can you advise what we have to do to get the Close function to work normally
when using the menu Close item or the X box in the form without forcing the
If Not m_blnOpenInsp code in your Listing 18.12 which generates the MsgBox??
Here is our Item_Write() and Item_Close code and we do have m_blnOpenInsp
declared and set to True in Item_Open().
'------------------------------------------------------------------------------------------
Private Function Item_Write() 'See Mosher Listing 18.3 and FormControlsDemo
code
If Not m_blnOpenInsp Then
MsgBox "Please open the item to make changes."
Item_Write = False
End If
If Item.FullName = " " Then
Item_Write = False
MsgBox "Please fill in the form."
Else
Call StoreVisitList
Call StoreScreenButtons
End If
End Function
'------------------------------------------------------------------------------------------
Private Function Item_Close()
m_blnOpenInsp = False
'MsgBox "Form is closing"
Call StoreVisitList
Set m_lstVisitList = nothing
Set m_objExcel = Nothing
Set m_objWB = Nothing
Set m_objWS = Nothing
Set m_objRange = Nothing
Set m_blnIsNew = Nothing
Set m_objActiveFolder = Nothing
Set m_objPage = Nothing
Set m_intRowCount = Nothing
End Function
'-------------------------------------------------------------------------------------------
I have made use of the approach you describe in section 18.3.1 of your book
in the code contained in all of our custom forms to prevent the user from
in-cell editing. It works for that purpose but as a result we are seeing
another anomaly in our folder based application which I cannot figure out how
to resolve.
Whenever we save an item by the "Save and Close" button, we can reopen it
normally and edit and save it again by the button. However, if we edit the
item after opening and then do a Save from the main menu and then later
attempt a Close from the menu, it pompts whether you want to save the item
and if you say Yes, it hangs up in the Write() function and displays the
Msgox "Please open the item to make changes" per your listing 18.12 in your
book. This doesn't make sense since the item is already open and also
indicates that somehow the variable m_blnOpenInsp is changing to False during
the Item_Write() or it wouldn't get to the MsgBox in the If statement. If
we also make some edits in the open item and then click the X box on upper
right of item form to create the close prompt that asks whether we want to
save the item or not, the same type of thing happens If you answer YES, it
gives the same MsgBox prompt and you can't save it...you HAVE to click the
close button and answer the prompt as NO without saving.
In either case, after you see the MsgBox prompt if you try to use the "Save
and Close" button the same thing happens and you HAVE to say NO to the prompt
and you can't salvage any of the edits you made.
Can you advise what we have to do to get the Close function to work normally
when using the menu Close item or the X box in the form without forcing the
If Not m_blnOpenInsp code in your Listing 18.12 which generates the MsgBox??
Here is our Item_Write() and Item_Close code and we do have m_blnOpenInsp
declared and set to True in Item_Open().
'------------------------------------------------------------------------------------------
Private Function Item_Write() 'See Mosher Listing 18.3 and FormControlsDemo
code
If Not m_blnOpenInsp Then
MsgBox "Please open the item to make changes."
Item_Write = False
End If
If Item.FullName = " " Then
Item_Write = False
MsgBox "Please fill in the form."
Else
Call StoreVisitList
Call StoreScreenButtons
End If
End Function
'------------------------------------------------------------------------------------------
Private Function Item_Close()
m_blnOpenInsp = False
'MsgBox "Form is closing"
Call StoreVisitList
Set m_lstVisitList = nothing
Set m_objExcel = Nothing
Set m_objWB = Nothing
Set m_objWS = Nothing
Set m_objRange = Nothing
Set m_blnIsNew = Nothing
Set m_objActiveFolder = Nothing
Set m_objPage = Nothing
Set m_intRowCount = Nothing
End Function
'-------------------------------------------------------------------------------------------