I have the following code attached to the "before update" event on my main customer form:
Sub Form_BeforeUpdate(Cancel As Integer)
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "Do you want to save changes ?" Style = vbYesNo + vbCritical + vbDefaultButton2
Title = "Data Changes"
Help = "DEMO.HLP"
Ctxt = 1000
Response = msgbox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then ' User chose Yes.
MyString = "Yes"
Cancel = False
Else ' User chose No.
MyString = "No"
Cancel = True
End If
End Sub
--
And here's my extremely annoying problem:
When the user clicks "Yes", the record should be saved, when they click "No", the formshould just wait for them to do something else.
The code works perfectly when they click on the save button or the close button, but when the user clicks on the "search" button (which uses filterbyform), it doesn't work as planned.
It asks them if they want to save the changes and if they say "yes"...it throws up and error about not being able to clear the grid during the filterbyform. If they say "No",it throws up the same "clear grid action not available now" error.
What am I missing?
If they say "yes" i want to to let them continue using the customer form and if they say "no", i want them to be taken to the filterbyform form.
I'm sorry this is so long-winded but I'm going nuts trying to figure this one out on my own -- any help would be very gratefully received!!
Thank you in advance,
Kathy
Sub Form_BeforeUpdate(Cancel As Integer)
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "Do you want to save changes ?" Style = vbYesNo + vbCritical + vbDefaultButton2
Title = "Data Changes"
Help = "DEMO.HLP"
Ctxt = 1000
Response = msgbox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then ' User chose Yes.
MyString = "Yes"
Cancel = False
Else ' User chose No.
MyString = "No"
Cancel = True
End If
End Sub
--
And here's my extremely annoying problem:
When the user clicks "Yes", the record should be saved, when they click "No", the formshould just wait for them to do something else.
The code works perfectly when they click on the save button or the close button, but when the user clicks on the "search" button (which uses filterbyform), it doesn't work as planned.
It asks them if they want to save the changes and if they say "yes"...it throws up and error about not being able to clear the grid during the filterbyform. If they say "No",it throws up the same "clear grid action not available now" error.
What am I missing?
If they say "yes" i want to to let them continue using the customer form and if they say "no", i want them to be taken to the filterbyform form.
I'm sorry this is so long-winded but I'm going nuts trying to figure this one out on my own -- any help would be very gratefully received!!
Thank you in advance,
Kathy