By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,790 Members | 1,398 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,790 IT Pros & Developers. It's quick & easy.

Suppress subform before update event with button

P: 34
Hi,
when a continuous subform before update event is triggered because a textbox in it is blank, is there any way to still be able to click a button on the parent form to escape the event (bit like using the escape key but using a button) ?

Thanks
Oct 17 '17 #1

✓ answered by NeoPa

What you describe is impossible. The Form's BeforeUpdate event is triggered by some form of save being activated. It cannot possibly be triggered by a TextBox being empty. It can behave in a particular way depending on the contents of a TextBox but certainly not triggered by it.

It's very difficult to give meaningful answers when the question doesn't make sense. You'll find far more answers to questions if you make the effort to tell us what the issue is more clearly and accurately. I understand that may be due to English being a foreign language but the clearer the question the better help you'll get for sure.

You may be looking for the .Undo method. It's hard to be sure in the circumstances.

On the other hand, when you find yourself having to do things the hard way and research for yourself, you often find you understand things a lot more clearly in the end.

Share this Question
Share on Google+
4 Replies


P: 34
Well,
the answer I found is no.Had to take a good look at events, slowly they are getting in my dense brain. The form is now working!!
Oct 23 '17 #2

NeoPa
Expert Mod 15k+
P: 31,418
What you describe is impossible. The Form's BeforeUpdate event is triggered by some form of save being activated. It cannot possibly be triggered by a TextBox being empty. It can behave in a particular way depending on the contents of a TextBox but certainly not triggered by it.

It's very difficult to give meaningful answers when the question doesn't make sense. You'll find far more answers to questions if you make the effort to tell us what the issue is more clearly and accurately. I understand that may be due to English being a foreign language but the clearer the question the better help you'll get for sure.

You may be looking for the .Undo method. It's hard to be sure in the circumstances.

On the other hand, when you find yourself having to do things the hard way and research for yourself, you often find you understand things a lot more clearly in the end.
Oct 30 '17 #3

P: 34
Thanks NeoPa, spent the last week going through a form events; bit clearer now.
What I wanted to ask was this:
when a Subform is saved the beforeUpdate event is triggered, in this case it won't let me continue unless the textbox has something in it. I wanted to have a button on the Form that can be pressed even if that textbox is empty. But that can't be done. The .undo is just what I have done, you guessed right. Thanks

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_BeforeUpdate(Cancel As Integer)
  2.     On Error GoTo ErrorHandler
  3.  
  4.  
  5.  
  6.         If IsNull(Me.txtPaymentAmount) Then
  7.             MsgBox "Amount needed", vbCritical, "ccPOS"
  8.             Cancel = True
  9.         End If
  10.  
  11.  
  12. ExitSub:
  13.     Exit Sub
  14. ErrorHandler:
  15.     MsgBox "Error No: " & Err.Number & vbNewLine _
  16.          & "Error Details: " & Err.Description & vbNewLine _
  17.          & "Error in Sub: frmPaySbf\Form_BeforeUpdate"
  18.     Resume ExitSub
  19. End Sub
Oct 30 '17 #4

NeoPa
Expert Mod 15k+
P: 31,418
I'm glad I could help. I do try. Sometimes I struggle to understand what is required from the wording but I always try if I can.
Oct 31 '17 #5

Post your reply

Sign in to post your reply or Sign up for a free account.