473,726 Members | 2,177 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is there a way to prevent BeforeUpdate from firing??

Hello,

I think what I'm asking for may not be possible, but I'll try anyway.

I have MainForm with 3 subforms, one SubForm requires data entry, the
other two don't (optional).

MainForm has some BeforeUpdate field validation code.

I would like to do the following:

1. Enter the required date on the main form.

2. After the date is entered, save the MainForm record with the
required date value, then move the user into the SubForm without firing
the MainForm's BeforeUpdate event (set the focus to the subform).

3. Then after the SubForm gets its data (only one field is filled in),
go back to the MainForm and continue entering data.

Otherwise I have to move all the subforms to the bottom of the MainForm
and that is counter-intuitive to the way people think about this data
etc.

Thank you, Tom

May 17 '06 #1
3 3223
Bri


tlyczko wrote:
Hello,

I think what I'm asking for may not be possible, but I'll try anyway.

I have MainForm with 3 subforms, one SubForm requires data entry, the
other two don't (optional).

MainForm has some BeforeUpdate field validation code.

I would like to do the following:

1. Enter the required date on the main form.

2. After the date is entered, save the MainForm record with the
required date value, then move the user into the SubForm without firing
the MainForm's BeforeUpdate event (set the focus to the subform).

3. Then after the SubForm gets its data (only one field is filled in),
go back to the MainForm and continue entering data.

Otherwise I have to move all the subforms to the bottom of the MainForm
and that is counter-intuitive to the way people think about this data
etc.

Thank you, Tom


Short answer, no you can't move off the newly created record and not
have the BeforeUpdate event fire.

You could have your validation code in a different location and have it
check the parent record as well as the child record (in the subform).
One idea would be to have the main form not allow additions. Then you
could have a New Button and a Save Button to control when a record is
started and ended. The validation code would be in the Save Button of
course. The New button is mearly a way to prevent the user from leaving
the current record to a new record without first saving using the save
button. In addition, the New button can activate the Save button and the
Save button can activate the New button so only one of them is active at
a time as required.

Sorry that was a bit rambly, but hopefully it will give you some ideas
to think about.

--
Bri

May 17 '06 #2
Well, at least I tried.
I redesigned the form so all the required data entry precedes the
subform and I will simply explain why it's done the way it is...
Maybe someone else knows an automagical solution...
Thank you, Tom

May 17 '06 #3
You cant stop the beforeupdate event running, that doesn't mean to say you
have to run the code in there.

Use a variable to indicate the state of the record and decide whether to run
the code.

Of course you can't have any required fields not filled in as this is a
database level validation.
--

Terry Kreft
"tlyczko" <tl*****@gmail. com> wrote in message
news:11******** **************@ j33g2000cwa.goo glegroups.com.. .
Hello,

I think what I'm asking for may not be possible, but I'll try anyway.

I have MainForm with 3 subforms, one SubForm requires data entry, the
other two don't (optional).

MainForm has some BeforeUpdate field validation code.

I would like to do the following:

1. Enter the required date on the main form.

2. After the date is entered, save the MainForm record with the
required date value, then move the user into the SubForm without firing
the MainForm's BeforeUpdate event (set the focus to the subform).

3. Then after the SubForm gets its data (only one field is filled in),
go back to the MainForm and continue entering data.

Otherwise I have to move all the subforms to the bottom of the MainForm
and that is counter-intuitive to the way people think about this data
etc.

Thank you, Tom

May 18 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
4041
by: William Wisnieski | last post by:
Hello Everyone, Access 2000 I have a form with multiple pages on it. There is one text field on the third page of the form that I need the user to complete before leaving the form or moving to the next record. So, in the BeforeUpdate event of the form itself I have the following code:
1
2475
by: Dalan | last post by:
Although I have used the code below to suppress the DoCmd cancel action message from appearing on lots of other actions such as preview and print, I have not been able to get to work on a BeforeUpdate Event Procedure. There is nothing elaborate about the event, however, there is an initial message box stating that if one field contains data then a second one must also, and then after clicking okay, the DoCmdMenuItem action box is...
0
1655
by: Deano | last post by:
My beforeupdate event on the main form fires when a change has been made and the record has not been saved (2 variables are used to track this). Works great but if they make a change in my subform which is in one tab of a tab control, and then they select a different tab, the beforeupdate event fires. So they get prompted as to whether they want to save the record - however the idea is that the event only fires if they try to close the...
9
2283
by: Daniel Walzenbach | last post by:
Hi I am faced with the following problem: I have a page (let’s call this page page1.aspx) containing some TextBoxes and a hyperlink which opens another page (let’s call this page page2.aspx) as a popup using either window.open or window.showModalDialog. Since I want to warn the users of my application when they try to close page1.aspx and have changed the values in the meantime I thought about using the “onbeforeunload” event of the...
4
3131
by: tlyczko | last post by:
I have been looking on the NGs and I found this code to show if a subform has no records. I have this code in the MAIN form OnClose event: Private Sub btnClose_Click() '4/16/06 new code that cancels the close event if the BeforeUpdate code fires '4/16/06 see...
3
2037
by: Mike-deerenews | last post by:
I would like to check for the existence of an attribute in order to prevent an exception from firing. Could someone provide an example? tia Mike
5
9999
by: Vincent | last post by:
I have a bound listbox control on one of my forms that has an associated afterupdate event. When this event is invoked, I lock the control to prevent the user from clicking on it more than once. However, it appears that Access is queuing the mouse clicks and calling the afterupdate event regardless of whether the control is locked or not. If I click the mouse quickly, Access generates the following error message: "The macro or function...
2
2848
by: APA | last post by:
Why does adding code to the form submit function using the RegisterOnSubmitStatement method prevent the server side event handler for the submit button from firing? This is completely useless. I need some custom javascript validation on form submit but why does is kill the submit button event handler? Submit buttons don't use __doPostBack so what is being effected?
7
5309
by: Richard Sherratt | last post by:
I'm trying to stop users deleting an existing value in a field. If they go to an existing record and hit delete, I want to give an error message and reverse the change. The BeforeUpdate event is firing and they get the error message. But when they click "OK", the change is not undone. They can hit enter and go on to the next field with the null not being undone. However, if they change to an illegal (not null) value, the change is undone....
0
8890
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, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9259
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9182
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9120
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6702
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4521
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3228
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.