Hi i am creating a database for a college Military Science department and have it just about done. I am encountering some issues with the debug phase. I need some error messages that are user friendly.
For instance:
I have a form that cadets will fill out. Information such as name, unit name, grade level, gpa, ect. ect.
When the teachers enter this into the database through the cadet form I want friendly error messages to appear if there is an empty field. Either when a save button is clicked or the text box loses focus. I have tried using the error codes (3314, ect.) but the code window will not return a code when I click save and an empty field is present, i do get the standard message. It does return the 3314 code when I click the "x" to close the form.
Any ideas?
4 3400
Hi i am creating a database for a college Military Science department and have it just about done. I am encountering some issues with the debug phase. I need some error messages that are user friendly.
For instance:
I have a form that cadets will fill out. Information such as name, unit name, grade level, gpa, ect. ect.
When the teachers enter this into the database through the cadet form I want friendly error messages to appear if there is an empty field. Either when a save button is clicked or the text box loses focus. I have tried using the error codes (3314, ect.) but the code window will not return a code when I click save and an empty field is present, i do get the standard message. It does return the 3314 code when I click the "x" to close the form.
Any ideas?
Place similar code to what I am showing you in the BeforeUpdate() Event of the Form, this way the Field Validation will be centralized, and regardless of which mechanism you may use to Save the Form, the Event will be fired and the Record will not be Saved until all Required Fields contain data. - Private Sub Form_BeforeUpdate(Cancel As Integer)
-
If IsNull(Me![Field1]) Then
-
MsgBox "You must enter a value in <Your Field Name>", vbExclamation, "Missing Entry"
-
Cancel = True: Me![Field1].SetFocus
-
ElseIf IsNull(Me![Field2]) Then
-
MsgBox "You must enter a value in <Your Field Name>", vbExclamation, "Missing Entry"
-
Cancel = True: Me![Field2].SetFocus
-
End If
-
End Sub
Place similar code to what I am showing you in the BeforeUpdate() Event of the Form, this way the Field Validation will be centralized, and regardless of which mechanism you may use to Save the Form, the Event will be fired and the Record will not be Saved until all Required Fields contain data. - Private Sub Form_BeforeUpdate(Cancel As Integer)
-
If IsNull(Me![Field1]) Then
-
MsgBox "You must enter a value in <Your Field Name>", vbExclamation, "Missing Entry"
-
Cancel = True: Me![Field1].SetFocus
-
ElseIf IsNull(Me![Field2]) Then
-
MsgBox "You must enter a value in <Your Field Name>", vbExclamation, "Missing Entry"
-
Cancel = True: Me![Field2].SetFocus
-
End If
-
End Sub
Alright. Now if I have 13 fields in the form would I just continue through to "field13"?
You could or you could loop thru the controls a variety of ways. Here's one example. It requires that you goto Properties - Other and enter a question mark (no quotation marks) in the Tag Property of each control you want to check. You can do this in one fell swopr by selecting all of the controls and changing the Tag property enmasse as it were. - Private Sub Form_BeforeUpdate(Cancel As Integer)
-
Dim Msg As String, Style As Integer, Title As String
-
Dim DL As String, ctl As Control
-
-
DL = vbNewLine & vbNewLine
-
-
For Each ctl In Me.Controls
-
-
If ctl.Tag = "?" Then
-
If Trim(ctl.Value & "") = "" Then
-
-
Msg = "'" & ctl.Name & "' is Required!" & DL & _
-
"Please enter a value or hit Esc to abort the record . . ."
-
Style = vbInformation + vbOKOnly
-
Title = "Required Data Missing! . . ."
-
MsgBox Msg, Style, Title
-
ctl.SetFocus
-
Cancel = True
-
Exit For
-
End If
-
End If
-
Next
-
End Sub
-
Welcome to TheScripts!
Linq ;0)>
Alright. Now if I have 13 fields in the form would I just continue through to "field13"?
Another option is to set the Required Property of these 13 Fields in the Table to Yes. If the Required Property is set to Yes, when you enter data in a Record, you must enter a value in the field or in any control bound to the field, and the value cannot be Null.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Covi |
last post by:
Hello,
I have a SS2K (SP3) that is appending very wierd looking error messages
to the SQL Server Log (Current). The messages are not formatted as
other log entries. The messages suggest some...
|
by: baustin75 |
last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie
only when debugging in php designer 2005
--------------------------------------------------------------------------------
...
|
by: PamelaDV |
last post by:
I have a database split for back end and front end and my back end (my
data) has been corrupting like crazy lately. Today we have compacted
and repaired like 4 times within an hour. The database...
|
by: Brian Conway |
last post by:
I have no idea what is going on. I have a Login screen where someone types
in their login information and this populates a datagrid based off of the
login. Works great in debug and test through...
|
by: Kris van der Mast |
last post by:
Hi,
I've created a little site for my sports club. In the root folder there are
pages that are viewable by every anonymous user but at a certain subfolder
my administration pages should be...
|
by: Adam Getchell |
last post by:
I'm attempting to write a custom Authentication module using http://www.15seconds.com/Issue/020417.htm
I looked at http://support.microsoft.com/default.aspx?scid=kb;EN-US;307996, but it doesn't...
|
by: Joergen Bech |
last post by:
Fairly new to ASP.NET 1.1. Getting the error below when running
application on a web server outside of my control, but only the first
time I run it:
1. After a long period of inactivity (or...
|
by: James Radke |
last post by:
Hello,
I have a multithreaded windows NT service application (vb.net 2003) that I
am working on (my first one), which reads a message queue and creates
multiple threads to perform the processing...
|
by: robert d via AccessMonster.com |
last post by:
I'm looking at converting DAO to ADO in my app. All of my DAO connections
are of the following structure:
Dim wsName As DAO.Workspace
Dim dbName As DAO.Database
Dim rsName As DAO.Recordset
...
|
by: CodeSeeker |
last post by:
I have an application, which uses pop3 to read the messages from the mailbox, and it has been working fine for so many year. We recently have started changing this application to use java mail IMAP 4...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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...
|
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...
|
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...
|
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...
|
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,...
| |