473,565 Members | 2,770 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Suppress subform before update event with button

72 New Member
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
4 2695
Neruda
72 New Member
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,564 Recognized Expert Moderator MVP
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 New Member
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,564 Recognized Expert Moderator MVP
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
2984
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 case HTML, can anyone tell me what I am doing wrong? Thanks in advance.
1
2957
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 want to cancel update event and allow user to enter the sub form to fill in all mandatory fields. I tried many code and don't have any solution to...
3
3945
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
1459
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 button, the text box widht is not dynamic. its fixed! So only a portion
1
1828
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 button my code (which is a mess from playing around!) (this is a test page im playing with) ID in the database is auto increment just cant seem to...
1
2528
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 Update event, but when I do a query, the table is not updated yet. Is there another event that fires after the data is updated? Similarly, if I delete...
0
1641
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 information like culture and title. From what I remember, when you switch to design view though, it should present an option in the properties toolbar...
4
5628
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 subform to appear & populate the feild "PO" in a second subform 2 "frmExpediteDetails". I think I need an after Update event but not sure of the code...
4
5810
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 "Floor" and "Location". The after update event of the combo box runs the following lines to update the next two fields. = Recipient.Column(2) ...
5
2840
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 with OpenRecordSet when accessing a SQL Server table that has an IDENTITY column." Please help.. thanks Private Sub Form_AfterUpdate() Dim...
0
7666
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7888
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7644
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7951
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3643
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1201
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.