473,554 Members | 3,225 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

BeforeUpdate problem with Multiple Page Form

Hello Everyone,

Access 2000

I have a form with multiple pages on it. There is one text field
[SupervisoryStat us] 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:

If Len(Me.Supervis oryStatus & "") = 0 Then
MsgBox "Please Indicate Supervisory Status."
DoCmd.CancelEve nt
Me.SupervisoryS tatus.SetFocus
End If

If this text field is blank and the user tries to leave the record or form,
it sends the user to the field so they can complete it. It works fine
except for one problem. If the user clicks on another page (clicks on the
tab) on the form, access thinks the user is trying to move to another record
so the BeforeUpdate event fires. I want the user to be able to move from
page to page without it firing, but I want it to execute if they actually
try to leave the form, or move to another record if the field is left blank.

This same problem occurs if I make the field a required field in the table.

Thanks for your help.

William

Nov 12 '05 #1
4 4029
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Do you have any subforms on the form? Is the user moving to the page
that holds that subform? If the user has made some edits/adds to the
main form and moves to the subform, the main form's BeforeUpdate event
runs.

The form BeforeUpdate event ONLY runs when a change/add has been made
to the record. Therefore, if the user hasn't made any changes to the
record when they move to another page/tab (subform) on the form, the
BeforeUpdate event shouldn't run. Is there some macro or code that
runs when the form opens, or on movement to another record, that puts
a value into one of the bound controls? This will cause the form to
be in edit mode, which will cause the BeforeUpdate event to run when
the user moves to a subform or moves to another record or closes the
form.

MGFoster:::mgf
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP7lhu4echKq OuFEgEQLtJgCffc OoJwlSsjTSWCQQw z7VophG7mYAn0WL
7u1wKgRVRaC3uPD jXXbjw0dg
=x5lf
-----END PGP SIGNATURE-----
William Wisnieski wrote:
Hello Everyone,

Access 2000

I have a form with multiple pages on it. There is one text field
[SupervisoryStat us] 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:

If Len(Me.Supervis oryStatus & "") = 0 Then
MsgBox "Please Indicate Supervisory Status."
DoCmd.CancelEve nt
Me.SupervisoryS tatus.SetFocus
End If

If this text field is blank and the user tries to leave the record or form,
it sends the user to the field so they can complete it. It works fine
except for one problem. If the user clicks on another page (clicks on the
tab) on the form, access thinks the user is trying to move to another record
so the BeforeUpdate event fires. I want the user to be able to move from
page to page without it firing, but I want it to execute if they actually
try to leave the form, or move to another record if the field is left blank.

This same problem occurs if I make the field a required field in the table.

Nov 12 '05 #2
Thanks for your reply. Yes, you're exactly right, I do have some subforms
on different pages. The users bounce down to the subform on different pages
of the main form. The field in question [SupervisoryStat us] is on the main
form however. Any suggestions on what code I should use to solve my
problem?

Thank you.

William
"MGFoster" <me@privacy.com > wrote in message
news:2l******** *********@newsr ead1.news.pas.e arthlink.net...
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Do you have any subforms on the form? Is the user moving to the page
that holds that subform? If the user has made some edits/adds to the
main form and moves to the subform, the main form's BeforeUpdate event
runs.

The form BeforeUpdate event ONLY runs when a change/add has been made
to the record. Therefore, if the user hasn't made any changes to the
record when they move to another page/tab (subform) on the form, the
BeforeUpdate event shouldn't run. Is there some macro or code that
runs when the form opens, or on movement to another record, that puts
a value into one of the bound controls? This will cause the form to
be in edit mode, which will cause the BeforeUpdate event to run when
the user moves to a subform or moves to another record or closes the
form.

MGFoster:::mgf
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP7lhu4echKq OuFEgEQLtJgCffc OoJwlSsjTSWCQQw z7VophG7mYAn0WL
7u1wKgRVRaC3uPD jXXbjw0dg
=x5lf
-----END PGP SIGNATURE-----
William Wisnieski wrote:
Hello Everyone,

Access 2000

I have a form with multiple pages on it. There is one text field
[SupervisoryStat us] 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:
If Len(Me.Supervis oryStatus & "") = 0 Then
MsgBox "Please Indicate Supervisory Status."
DoCmd.CancelEve nt
Me.SupervisoryS tatus.SetFocus
End If

If this text field is blank and the user tries to leave the record or form, it sends the user to the field so they can complete it. It works fine
except for one problem. If the user clicks on another page (clicks on the tab) on the form, access thinks the user is trying to move to another record so the BeforeUpdate event fires. I want the user to be able to move from page to page without it firing, but I want it to execute if they actually try to leave the form, or move to another record if the field is left blank.
This same problem occurs if I make the field a required field in the
table.

Nov 12 '05 #3
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

To prevent users from saving a record before all "required" data has
been entered I put a DataOK function call in the main form's
BeforeUpdate event - much like the check you had for data in the
SupervisoryStat us. E.g.:

Private Sub Form_BeforeUpda te(Cancel As Integer)

Cancel = Not DataOK()

End Sub

The function DataOK checks for the existence of required data & if
DataOK = False gives an error message "Required Data Missing" & a list
of fields that require data & returns False to the Form's BeforeUpdate
event, which sets Cancel to True & stops the save of the main form's
record.

For subforms I've also used the subform control's OnEnter event to
call the DataOK function. If the DataOK function returns False the
OnEnter event sets the focus to a Control on the main form. This way
the user can't enter the subforms before all required data on the main
form has been entered.

HTH,

MGFoster:::mgf
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP7nn24echKq OuFEgEQL7CgCgrh aTi5mcLJGZHjhN6 8EEk99EvNIAnRMv
KyB/UlwL5Hw3SVbyB9b 0MhCs
=rzoo
-----END PGP SIGNATURE-----

William Wisnieski wrote:
Thanks for your reply. Yes, you're exactly right, I do have some subforms
on different pages. The users bounce down to the subform on different pages
of the main form. The field in question [SupervisoryStat us] is on the main
form however. Any suggestions on what code I should use to solve my
problem?

Thank you.

William
"MGFoster" <me@privacy.com > wrote in message
news:2l******** *********@newsr ead1.news.pas.e arthlink.net...
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Do you have any subforms on the form? Is the user moving to the page
that holds that subform? If the user has made some edits/adds to the
main form and moves to the subform, the main form's BeforeUpdate event
runs.

The form BeforeUpdate event ONLY runs when a change/add has been made
to the record. Therefore, if the user hasn't made any changes to the
record when they move to another page/tab (subform) on the form, the
BeforeUpdat e event shouldn't run. Is there some macro or code that
runs when the form opens, or on movement to another record, that puts
a value into one of the bound controls? This will cause the form to
be in edit mode, which will cause the BeforeUpdate event to run when
the user moves to a subform or moves to another record or closes the
form.

MGFoster:::mg f
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP7lhu4echKq OuFEgEQLtJgCffc OoJwlSsjTSWCQQw z7VophG7mYAn0WL
7u1wKgRVRaC3u PDjXXbjw0dg
=x5lf
-----END PGP SIGNATURE-----
William Wisnieski wrote:

Hello Everyone,

Access 2000

I have a form with multiple pages on it. There is one text field
[SupervisoryStat us] 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:
If Len(Me.Supervis oryStatus & "") = 0 Then
MsgBox "Please Indicate Supervisory Status."
DoCmd.CancelEve nt
Me.SupervisoryS tatus.SetFocus
End If

If this text field is blank and the user tries to leave the record or
form,
it sends the user to the field so they can complete it. It works fine
except for one problem. If the user clicks on another page (clicks on
the
tab) on the form, access thinks the user is trying to move to another
record
so the BeforeUpdate event fires. I want the user to be able to move
from
page to page without it firing, but I want it to execute if they
actually
try to leave the form, or move to another record if the field is left
blank.
This same problem occurs if I make the field a required field in the


table.



Nov 12 '05 #4
rkc

"William Wisnieski" <wi************ ***@verizon.net > wrote in message
news:%0******** ***********@nwr dny02.gnilink.n et...
Hello Everyone,

Access 2000

I have a form with multiple pages on it. There is one text field
[SupervisoryStat us] 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:
If Len(Me.Supervis oryStatus & "") = 0 Then
MsgBox "Please Indicate Supervisory Status."
DoCmd.CancelEve nt
Me.SupervisoryS tatus.SetFocus
End If

If this text field is blank and the user tries to leave the record or form, it sends the user to the field so they can complete it. It works fine
except for one problem. If the user clicks on another page (clicks on the
tab) on the form, access thinks the user is trying to move to another record so the BeforeUpdate event fires. I want the user to be able to move from
page to page without it firing, but I want it to execute if they actually
try to leave the form, or move to another record if the field is left

blank.

This happens when you have a subForm on a tab. It's the same as setting
focus to a seperate form. The only solution I know of is to create a record
source for the main form that contains every field you need to make an
entry.

Could be solutions I don't know of though.
Nov 12 '05 #5

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

Similar topics

4
11517
by: bob bob via AccessMonster.com | last post by:
I'm sure this is a simple one. I have a combo box that, when its data is changed, will trigger a second form to open for input. If the operator declines input, I want the combo box to return to its original value. The on change event is wrong for this, since the new data has already been saved. As I undertand it, the beforeupdate event...
15
4794
by: simonmarkjones | last post by:
I want to validate my form using a BeforeUpdate event. However now that i call my code with a beforeupdate it wont let me go to next or previous records. What code should i put in o allow me to do thi??
9
3364
by: simonmarkjones | last post by:
I want to call a function which does this when the next record button is pressed (calling it from before update) if textboxes are empty then Message box you must fill text box
2
14810
by: PC Datasheet | last post by:
In a form/subform I have an unbound combobox in the form header that sets the value of a field in the subform so that it does not have to be entered for each record. In the BeforeUpdate event of the combobox I have some code to check the value against some criteria and if the new selected value fails the criteria, I cancel the BeforeUpdate...
6
3117
by: lorirobn | last post by:
Hi, I have a form with a continuous subform. I am working on putting validations in for the subform's required fields. Being somewhat new to Access (or rather, an antiquated mainframe programmer), I finally figured out that the place to put the validations is in Form_BeforeUpdate. I have 2 questions: 1) once I determine there is an...
6
7591
by: tlyczko | last post by:
I have a BeforeUpdate where I need to ensure that no matter what, the first four fields on the form (one text box, 3 combo box lists) have data entered in them before the user closes the form or before the user moves off the form to a subform on the main form, regardless of whether the end user even put focus to any of the four form fields. ...
3
3203
by: tlyczko | last post by:
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:
2
2669
by: thatguyNYC | last post by:
Hello-- I have a form that lets the user edit the values in a lookup table. The form is bound to a table and has one textbox on it. The record nav buttons are enabled. On the top half of the form, I have a listbox showing all the records in the table. The user can double-click the listbox to jump to that record via this code: ...
7
6846
by: john.cole | last post by:
I have searched all the groups I can, and I still haven't been able to come up the solution I need. I have the following problem. In my form named sbfrmSpoolList, I am entering a job, spool and revision number. My table is indexed properly to not allow duplicates, but I would like teh user to be notified that they are typing a duplicate...
0
7519
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...
0
7798
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. ...
0
8039
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...
1
7560
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
7887
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...
0
6140
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5152
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
3545
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1130
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.