473,474 Members | 1,304 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

BeforeUpdate and error handling help needed

1 New Member
I'm a relative newbie to coding (and brand new here!) and I'm in need of some help. Hopefully, someone here will be willing to walk me through this and maybe I'll learn something along the way.

I have a database with a form where I would like to require data to be entered in certain fields. I would like to use the before Update event for this. I would like to check each of the 4 required fields, and if any of them are null, I'd like a message telling the user this and giving them the option of closing the form without saving the data or keep the form open to complete the required fields. One of these required fields is also a required record for another field on the form, so if the user happens to leave that particular field empty, they also trigger the "Record cannot be added or changed because a related record is required..." message. I would like to completely supress and ignore that message since the Before Update event that validates data will already establish this as a required field for the user. The required fields are: strCity. strAddress, strContact, and numCounty.

I should say that I can create the BeforeUpdate event to check for nulls just fine, except that the structure I've used isn't very friendly. There's a better way, but I can't figure out the proper structure. The way I accomplished it, my custom message box appears once for each field that is null, for a total of 4 times, instead of once regardless of how many of those fields are null.

Thanks so much for anyone who is wiiling to help me through this.
Jul 19 '10 #1
2 1529
patjones
931 Recognized Expert Contributor
Can you post the relevant code that you have so far, and we can go from there? Thanks.

Pat
Jul 20 '10 #2
NeoPa
32,556 Recognized Expert Moderator MVP
Do you realise there is already a Validation Rule property for the table as a whole?

In Design View of the table, select View / Properties (or Alt-Enter) to view the Properties page.
Jul 20 '10 #3

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

Similar topics

2
by: WSeeger | last post by:
When creating a new class, is it encouraged to always include error handling routines within your LET and GET procedures? It's seems that most text books never seem to include much about error...
3
by: Dave | last post by:
Hello all, I found Herb Sutter's article regarding error handling in the most recent CUJ to be very, very good. However, in trying to apply what I learned from the article, I am left with some...
12
by: Christian Christmann | last post by:
Hi, assert and error handling can be used for similar purposes. When should one use assert instead of try/catch and in which cases the error handling is preferable? I've read somewhere that...
21
by: Anthony England | last post by:
Everyone knows that global variables get re-set in an mdb when an un-handled error is encountered, but it seems that this also happens when the variable is defined as private at form-level. So...
3
by: Stefan Johansson | last post by:
Hi all I'am moving from Visual Foxpro and have a question regarding "best practice" error handling in vb .net. In VFP I have always used a "central" error handling object in order to have a...
35
by: jeffc226 | last post by:
I'm interested in an idiom for handling errors in functions without using traditional nested ifs, because I think that can be very awkward and difficult to maintain, when the number of error checks...
0
by: Lysander | last post by:
Thought I would give something back with a few articles. This article is a bit of code to add error handling. When I have time, I want to write articles on multilingual databases, and Access...
2
by: Axel Gallus | last post by:
I am desperately looking for some resources dealing with error handling in c++. Don't get me wrong.... I have very detailed knowledge of exceptions, assertions and invariants, but what is...
8
by: JWest46088 | last post by:
I'm having problems with my error handling. It's kind of hard to explain so I'll just post my code and bold where the error handling is and then explain what is happening. Just to warn you, I am...
2
by: nguyenminhhai | last post by:
Hi everyone, I'm reading "The C++ Programming Language" (Bjarne Stroustrup, 3rd edition). At page 193, he said "Doing error handling using the same level of abstraction as the code that caused the...
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
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,...
1
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...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
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...

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.