473,394 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Suppress subform before update event with button

72 64KB
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.

4 2681
Neruda
72 64KB
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
32,556 Expert Mod 16PB
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
Neruda
72 64KB
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
32,556 Expert Mod 16PB
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

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

Similar topics

4
by: joe.osowski | last post by:
I've been staring at this a while, and I haven't had much luck with it. So I figure I'll try Usenet. No matter what I try, it seems the event.button property is always "0". Here is my test...
1
by: Jason | last post by:
I have a main form with a sub form. All the fields in the subform are mandatory. I had some code on the main form Before Update Event to check if all the fields in the sub form have data. If not, I...
3
by: David | last post by:
Hi I use a calendar to update a field and the after update event no longer works, if i manually update it there is not a problem. How can I get this event to trigger Thanks in advance Dave
0
by: Tom | last post by:
I created a c# web form. I added a DataGrid1 to it. I added the Edit, Update, Cancel Button Column. I added two Bound columns. All is well. But when I run the app and press the edit...
1
by: luna | last post by:
trying to create an update/insert button basically if the record exists in the database i want to do an update if it doesnt exist i want to create a new record using insert all using the same...
1
by: Tony | last post by:
Hi, In a form, when I modify some data and move to the next record, I want be able to trap an event and do a query to check on the change done to the table. Currently, I use the form After...
0
by: enantiomer | last post by:
Having a problem with visual studio 2005 doing ASP.net. when in source mode (i.e. looking at the html directly), in the properties toolbar is an option called "DOCUMENT". It has some basic...
4
by: Mikep99 | last post by:
I am new to access and need some help with coding. I have a main form XYZ with 2 subforms. I have a checkbox on subform1 "frmExpediteS" that when checked i would like the Value in Feild "PO" of this...
4
by: injanib via AccessMonster.com | last post by:
I have a combo box called "Recipient" who's row source is a table called "Main" with three columns. The three columns are "Name", "Floor", "Location". Following the combo box are two fields called...
5
by: Zeeshan7 | last post by:
After Update Event Procedure on a form is not working after upsizing database to SQL server. Anything to add in below code as it generate run time error 3622 "You must use the dbSeeChanges option...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.