473,624 Members | 2,223 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Time Input Error Trap

I'd like to trap an error if a user inputs a bogus time. The input requires
a short time format. If the user enters someting like 20:78, Access will
catch that but I'd like something of my own.
Thank.
Rebecca
Nov 13 '05 #1
2 1763
Rebecca Smith wrote:
I'd like to trap an error if a user inputs a bogus time. The input requires
a short time format. If the user enters someting like 20:78, Access will
catch that but I'd like something of my own.
Thank.
Rebecca


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Use the Form's OnError event to catch the error (2113). The following
is a VERY basic error handler:

Private Sub Form_Error(Data Err As Integer, Response As Integer)

If DataErr = 2113 And Screen.ActiveCo ntrol.Name = "TimeInput" Then
MsgBox "Invalid Time" & vbcr & _
"The Hours must be 0 to 23 and the Minutes must be 0 to 59"
End If

End Sub

--
MGFoster:::mgf0 0 <at> earthlink <decimal-point> net
Oakland, CA (USA)

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

iQA/AwUBQioNvoechKq OuFEgEQJ+yACaA+ qHh/va9Z/3hLwZAMF5BEPaGD wAn2aZ
c7HJuNhgTNramXJ ciXTpSLgN
=QiJN
-----END PGP SIGNATURE-----
Nov 13 '05 #2
MG,
Using your code as written I still got the system error message after
closing the MsgBox. So, starting with what you gave and a very wee bit of
tweaking thanks to 'Access 97 Macro & VBA Handbook' (although my db is 2003)
I came up with:
*************** ****
Private Sub Form_Error(Data Err As Integer, Response As Integer)
Select Case DataErr
Case 2113
MsgBox strTimeErrorOne , , strDbTitle
Response = acDataErrContin ue
Case Else
Response = acDataErrDispla y
End Select
End Sub
*************** ****
Thanks for the steer in the right direction.
Rebecca

PS - Haven't been to Oakland in years - I used to live over by the Rose
Garden
Nov 13 '05 #3

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

Similar topics

8
1857
by: Oeln | last post by:
If I want to check for input of an integer I've got the following (I get the form input with $input = "$_POST"): if(!ereg("^+$",$_POST)) { echo "Input is incomplete or incorrect."; } If, instead of only getting one 'input' I wanted to get n instances of input, I'd generate input fields for each of n instances I want in a for loop, then get the input with:
10
4404
by: nkp | last post by:
Sorry guys, basic questions..... 1)how do you prevent negative numeric input in a text box (-2345 etc) 2)how do detect /prevent input of LESS than 8 characters in a text box( where a password must be a minimum of 8 characters for example) Thank you.
1
2180
by: Anzu | last post by:
I've been working on a script that finds and updates a record in database based on the user's input. When I try it I get this error: Active Server Pages, ASP 0113 (0x80004005) The maximum amount of time for a script to execute was exceeded. Yo can change this limit by specifying a new value for the propert Server.ScriptTimeout or by changing the value in the IIS administratio tools. As I can't post a message for some reason whenever...
10
2431
by: Mike D | last post by:
I have a table in SQL 2000 with a composite Primary Key on coulumns Instrument_ID (int) and WeekOf (smalldatetime.) I am running asp on win 2003. I insert values using a stored procedure from this ASP: InsertSQL = "Execute osp_insert_Instrument_Schedule " InsertSQL = InsertSQL & "@UserName = '" & strUserName & "', " InsertSQL = InsertSQL & "@DateInput = '" & Date() & "', " InsertSQL = InsertSQL & "@Instrument_ID = " & strInstrument_ID &...
2
8449
by: ColinWard | last post by:
My previous message was blank so Im trying again. I have a button on a form which opens the Import dialogue box. This works fine except if I click on the "X" to close the form I get Run-Time Error 2501: the DoMenuItem was Cancelled". How can I trap this error so that it doesn't display but simply closes the form? Thanks Colin
29
2236
by: Enrico `Trippo' Porreca | last post by:
Both K&R book and Steve Summit's tutorial define a getline() function correctly testing the return value of getchar() against EOF. I know that getchar() returns EOF or the character value cast to unsigned char. Since char may be signed (and if so, the return value of getchar() would be outside its range), doesn't the commented line in the following code produce implementation-defined behaviour?
9
3841
by: Ben | last post by:
Hi, In ASP.NET website, I have a web page is used to dump raw data into database (SQL Server). The database data will corrupt if two users dump raw data concurrently. How to allow only one user to access a web page at one time? Thanks, Ben
4
2813
by: Jimmy | last post by:
Quick question for you. I'm using a small form for users to input a range of dates for a report (similar to the date range forms used in MS templates) that has an ok and a cancel button. How can I set up the cancel button so that is does just that? As it is right now, the event for the cancel button is simply docmd.close but if I click this button, ms prompts me to enter parameter values for begindate and enddate. If i cancel out of these...
3
5164
by: Jim Armstrong | last post by:
Hello all - This is driving me crazy. I have a table called tblClients - very simple, has the following fields: taxID (PK) ClientName SalesName The main form of my application allows a user to select a client and
0
8238
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
8174
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,...
1
8336
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
7164
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...
0
5565
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
4082
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...
0
4176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2607
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
1
1786
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.