473,692 Members | 2,034 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

BeforeUpdate to Validate form

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??

Nov 13 '05 #1
15 4808
Ive tried putting in

DoCmd.GoToRecor d , , acNewRec

If all the checks are complete

But i get a runtime error of 2105

Saying you can not go to the sepecified record

Nov 13 '05 #2
<si************ @gmail.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
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??

What precisely do you mean by "validate my form"?

Keith.
Nov 13 '05 #3
I am checking each text filed in turn to see if it has been filled out.

Once they have all been filled i create another value (a receipt
number) which i store in another textbox which is not being validated
in this.

All my code works except when i call it from BeforeUpdate it validates
creates the new value but doesnt go to the next form/record. And its
getting pretty anoying.

Nov 13 '05 #4
<si************ @gmail.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
I am checking each text filed in turn to see if it has been filled out.

Once they have all been filled i create another value (a receipt
number) which i store in another textbox which is not being validated
in this.

All my code works except when i call it from BeforeUpdate it validates
creates the new value but doesnt go to the next form/record. And its
getting pretty anoying.

Well without having seen your code I'm guessing that you're trying to go to
a new/next record from the Before Update event but that is illogical
(captain) because you have to update the current record before you can go to
a new one. Have you tried your validation code in the Before Update event
(as you have now) but have your record navigation code in the After Update
event? Your record should update as a result of navigating away from it.

HTH - Keith.
www.keithwilby.com
Nov 13 '05 #5
Yeah i've put
DoCmd.GoToRecor d , , acNext
and DoCmd.GoToRecor d , , acNewRec
into afterupdate and all that happens is my form just sits there and
doesnt go to the new record.

Never done much programming before

Nov 13 '05 #6
<si************ @gmail.com> wrote in message
news:11******** *************@o 13g2000cwo.goog legroups.com...
Yeah i've put
DoCmd.GoToRecor d , , acNext
and DoCmd.GoToRecor d , , acNewRec
into afterupdate and all that happens is my form just sits there and
doesnt go to the new record.

Never done much programming before

The event(s) must not be firing. How and where are you committing the
record?
Nov 13 '05 #7
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

else

comit the record and move to next record

Nov 13 '05 #8
<si************ @gmail.com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. .
I want to call a function which does this when the next record button
is pressed (calling it from before update)

I appreciate what you are trying to achieve but how about answering my
question, where and when are you committing the record? Starting a new
thread every time you get frustrated will just irritate people.
Nov 13 '05 #9
Sorry i didnt realise.

Only just started using newsgroups.

And thats what i cant do. Dont know how to commit the record. Or where
appart from what ive already stated.

Nov 13 '05 #10

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

Similar topics

4
4039
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:
4
11533
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 won't work either, since it applied to the entire form. Would ondirty be the right event to use? ...
9
3376
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
0
1649
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...
2
14820
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 event. I need the combobox to return to its previous value. For example, the current value is MyValue...
6
3124
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 error and display a message box with
6
7595
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. (It is easy to know if all 4 fields have values, but not if less than four fields have values.) ...
3
3212
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
2680
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: Me.RecordsetClone.FindFirst " = '" & Trim(Nz(Me.lstSaluts)) & "'" If Not Me.RecordsetClone.EOF Then...
0
8603
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8538
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
9083
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8960
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...
0
7627
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6459
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
5818
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4557
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
1957
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.