on 2015 Dec 30 6:46 AM
Hi,
I have a very small validation requirement that I need to perform just before refreshing the Input Form and it is working as per my requirement.
But when I am saving the data from Input Form, again that Before_refresh event is triggering which I don't need.
VBA Code:
Function BEFORE_REFRESH()
If Application.ActiveSheet.Name = "Input Sheet - PM_Annual Budget" Then
answer = MsgBox("Are you sure you want to Refresh the Input Form? Unsaved data will be lost !!", vbYesNo + vbQuestion, "EPM Refresh Data")
If answer = 6 Then
'Conitnure refreshing
Else
BEFORE_REFRESH = False
End If
End If
End Function
Please suggest why before_refresh event is triggering after clicking on save button and how to stop it.
Regards,
Bharat
Request clarification before answering.
Please read my code and comments here:
In general when you press save button you have the following events:
BEFORE_SAVE
... data is saved
BEFORE_REFRESH
AFTER_REFRESH
AFTER_SAVE
If you want to avoid message in BEFORE_REFRESH during save - just set some global variable in BEFORE_SAVE and check it in BEFORE_REFRESH, then clear!
Based on this global variable you will be able to avoid message during save.
Vadim
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Something like:
Dim blnInSave As Boolean
Public Function BEFORE_SAVE() As Boolean
blnInSave = True
BEFORE_SAVE = True
End Function
Public Function BEFORE_REFRESH() As Boolean
If blnInSave Then
BEFORE_REFRESH = True
blnInSave = False
Else
If Application.ActiveSheet.Name = "Input Sheet - PM_Annual Budget" Then
If MsgBox("Are you sure you want to Refresh the Input Form? Unsaved data will be lost !!", _
vbYesNo + vbQuestion, "EPM Refresh Data") = 6 Then
BEFORE_REFRESH = True
Else
BEFORE_REFRESH = False
End If
Else
BEFORE_REFRESH = True
End If
End If
End Function
Hi Bharat,
If you are using standard EPM save data button, this is the normal behavior i.e. it save data first and then refresh.
Shrikant
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 8 | |
| 8 | |
| 7 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.