473,406 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

MAccess form error creation

I am creating a form that a person enters a date span in yyyymm form.
I want a box to pop up that tells the user "Please enter date in
correct format" if the user has entered the data incorrect. I have
entered the input mask and the auto tab order. I have done this
before, but I cannot remember the syntax for the code to pop up the
error box. Please help.
Nov 12 '05 #1
3 1655
The MsgBox statement displays a MessageBox. If you want a response, use the
MsgBox function. The operands/arguments determine the "severity" and the
possible responses.

Larry Linson
Microsoft Access MVP

"Jeremy" <jc*******@rmhp.org> wrote in message
news:e9**************************@posting.google.c om...
I am creating a form that a person enters a date span in yyyymm form.
I want a box to pop up that tells the user "Please enter date in
correct format" if the user has entered the data incorrect. I have
entered the input mask and the auto tab order. I have done this
before, but I cannot remember the syntax for the code to pop up the
error box. Please help.

Nov 12 '05 #2
If I understand you correctly, the InputMask in not needed, instead use a
Format of yyyy"/"mm
It should automatically change to yyy\/mm

Goto the Events tab of the form and choose [Event Proceedure] as the setting
for the OnError event. Click the builder button beside this and put in the
following...

Select Case DataErr
Case 2113 '----The value you entered isn't valid for this field...error
If Screen.ActiveControl = Me!Text0 Then
MsgBox "Please enter only valid Date information in the form of
yyyy/mm.", vbOKOnly, "Invalid Date"
Response = acDataErrContinue
End If
Case Else
Response = acDataErrDisplay
End Select

This should allow you to trap most errors and determine what control
triggered it. Add a new CASE section for each form error you wish to trap,
and use Screen.ActiveControl to tailor the process according to the control
that caused it.

Mike Storr

PS - I based this assuming you are working in A97, but I'm pretty sure this
should still apply in 2K
"Jeremy" <jc*******@rmhp.org> wrote in message
news:e9**************************@posting.google.c om...
I am creating a form that a person enters a date span in yyyymm form.
I want a box to pop up that tells the user "Please enter date in
correct format" if the user has entered the data incorrect. I have
entered the input mask and the auto tab order. I have done this
before, but I cannot remember the syntax for the code to pop up the
error box. Please help.

Nov 12 '05 #3
jc*******@rmhp.org (Jeremy) wrote in message news:<e9**************************@posting.google. com>...
I am creating a form that a person enters a date span in yyyymm form.
I want a box to pop up that tells the user "Please enter date in
correct format" if the user has entered the data incorrect. I have
entered the input mask and the auto tab order. I have done this
before, but I cannot remember the syntax for the code to pop up the
error box. Please help.


OnExit of field...
If not IsDate(MyField) then
msgbox "Date should be in <whatever> format", vbokonly, "Wrong date format"
Me.MyDateField.Setfocus
End If

Or something like that...
Nov 12 '05 #4

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

Similar topics

4
by: Nomen Nescio | last post by:
can anyone be so kind as to look at http://www.mysolution.ws/HYPOCRITE.php and let me know why it isn't passing the form data to http://www.mysolution.ws/insertHYPOCRITES.php for the most...
8
by: Sergio Otoya | last post by:
Hi all, I need to add an input hidden field to an existing form (post). I have tried a couple things like adding the '<INPUT type=hidden name=idSelectedURL value=http://server/documents>' to...
4
by: Stuart Perryman | last post by:
Hi, I have the following code which works just fine in IE6 but not in Firefox. It is an extract of several table rows each with an individual form. It is generated by php. <form...
1
by: googleboy | last post by:
Hi. I am writing up my own web form. I'm a bit of a newb, and read up many different how-tos and examples and documentaion. I finally had it working just great until I decided that I wanted to...
1
by: longtim | last post by:
I have been having endless difficulty creating reports/queries that set any relevent parameters from controls in forms. I am creating an application under access 2003 but will target access...
7
by: Tom wilson | last post by:
I'm trying to create dynamic controls in ASP.Net. It's driving me nuts. I keep getting the error: Control '16' of type 'RadioButton' must be placed inside a form tag with runat=server. Dim...
7
by: Bob | last post by:
I have a winforms app written in Vs2005 Vb.Net, The setiings are to Enable the application Framework and I defined a splashform. Works fine if no errors occur. I do a checking on the mainform load...
6
by: Mark | last post by:
so after much searching, and thinking, and pondering and planning, i came up with this most amazing thing, and then realized one major flaw which i was hoping you guys might help me overcome. ...
9
by: RvGrah | last post by:
I'm completely new to using background threading, though I have downloaded and run through several samples and understood how they worked. My question is: I have an app whose primary form...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
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
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...
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
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...
0
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...
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,...

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.