CodeConnect.Net Beta


   Explore    Entry   Register  Login  
windowsxp-general
access
windows-vista-mail
windows-vista-general
windowsupdate
windowsmedia-player
access-forms
windows-live-mail-desktop
windowsxp-help_and_support
access-queries
access-modulesdaovba
access-formscoding
windows-server-sbs
windows-server-general
access-reports
windows-vista-music_pictures_video
windowsce-platbuilder
windows-live-messenger
windows-terminal_services
windows-powershell
windows-server-active_directory
access-gettingstarted
windows-mediacenter
windowsxp-hardware
windowsxp-network_web
windows-64bit-general
windows-live-sync
windows-vista-hardware_devices
windows-inetexplorer-ie6_outlookexpress
windows-group_policy
windows-server-networking
windows-vista-installation_setup
windows-vista-networking_sharing
windowsxp-basics
access-tablesdbdesign
windowsxp-perform_maintain
windows-vista-performance_maintenance
windows-networking-wireless
windows-vista-file_management
windows-inetexplorer-ie6-browser
windows-server-dns
windows-server-update_services
windows-vista-security
windows-vista-administration_accounts_passwords
windows-vista-games
windows-file_system
access-activexcontrol
windows-live-foldershare
windows-live-photogallery
access-developers-toolkitode
access-conversion




Can Reply:  Yes Members Can Edit: No Online: Yes
Zone: > Microsoft News > microsoft.public.access Tags:
Item Type: Date Entered: 11/10/2009 5:01:53 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 4 Views: 241 Favorited: 0 Favorite
5 Items, 1 Pages 1 |< << Go >> >|
eda <ikh1@corne
NewsGroup User
Properties - Format, Input Mask, Validation Rule11/10/2009 5:01:53 PM
Reply

0

Hello,

I'm adding a new field to a table to hold a date. The field must be
able to except input in all three of the following ways:

yyyy (just the year, without month or day)
yyyy-mm (just the year and month, without the day) or
yyyy-mm-dd (year, month, and date)

Since usually it would just hold the year, it doesn't have to be a
DATE data type, it can be TEXT. However, I don't know how to create a
format or input mask where everything past the yyyy is optional. I
guess I could leave it without any format or input mask and just use a
validation rule, but I can't figure out how to make that work either.
Can anyone help?

John Spencer <s
NewsGroup User
Re: Properties - Format, Input Mask, Validation Rule11/10/2009 5:39:47 PM
Reply

0

Your validation rule might be something like

Like "####" OR Like "####-[0-1]#" OR Is Null OR Like "####-[0-1]#-[0-3]#"

Of course that will allow bad date values to be entered even if they meet the
pattern. For instance "9999-14-32" or even "2001-02-29"


John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

eda wrote:
> Hello,
>
> I'm adding a new field to a table to hold a date. The field must be
> able to except input in all three of the following ways:
>
> yyyy (just the year, without month or day)
> yyyy-mm (just the year and month, without the day) or
> yyyy-mm-dd (year, month, and date)
>
> Since usually it would just hold the year, it doesn't have to be a
> DATE data type, it can be TEXT. However, I don't know how to create a
> format or input mask where everything past the yyyy is optional. I
> guess I could leave it without any format or input mask and just use a
> validation rule, but I can't figure out how to make that work either.
> Can anyone help?
>
eda <ikh1@corne
NewsGroup User
Re: Properties - Format, Input Mask, Validation Rule11/10/2009 6:42:57 PM
Reply

0

That's perfect, thanks!

On Nov 10, 12:39=A0pm, John Spencer <spen...@chpdm.edu> wrote:
> Your validation rule might be something like
>
> Like "####" OR Like "####-[0-1]#" OR Is Null OR Like "####-[0-1]#-[0-3]#"
>
> Of course that will allow bad date values to be entered even if they meet=
the
> pattern. For instance "9999-14-32" =A0or even "2001-02-29"
>
> John Spencer
> Access MVP 2002-2005, 2007-2009
> The Hilltop Institute
> University of Maryland Baltimore County
>
> eda wrote:
> > Hello,
>
> > I'm adding a new field to a table to hold a date. =A0The field must be
> > able to except input in all three of the following ways:
>
> > yyyy =A0 (just the year, without month or day)
> > yyyy-mm =A0 (just the year and month, without the day) =A0or
> > yyyy-mm-dd =A0 (year, month, and date)
>
> > Since usually it would just hold the year, it doesn't have to be a
> > DATE data type, it can be TEXT. =A0However, I don't know how to create =
a
> > format or input mask where everything past the yyyy is optional. =A0I
> > guess I could leave it without any format or input mask and just use a
> > validation rule, but I can't figure out how to make that work either.
> > Can anyone help?

"KenSheridan vi
NewsGroup User
Re: Properties - Format, Input Mask, Validation Rule11/10/2009 7:34:39 PM
Reply

0

Have you considered using three separate fields for the year, month a day-of-
month? Its always easier to combine values from separate fields than to
parse a single value, and it would make the formatting and input masks easier
to set up. On a form you can use three contiguous text boxes with a hyphen
character between each as labels. You could include some validation code in
the day-of-month control's BeforeUpdate EventProcedure to test for an invalid
date, e.g.

Private Sub txtDay_BeforeUpdate(Cancel As Integer)

Const BAD_DATE = 13
Const MESSAGETEXT = "Invalid date"
Dim dtmDate As Date

If Not IsNull(Me.txtDay) Then
On Error Resume Next
dtmDate = CDate(Me.txtYear & "-" & Me.txtMonth & "-" & Me.txtDay)
Select Case Err.Number
Case 0
' no error
Case BAD_DATE
MsgBox MESSAGETEXT, vbExclamation, "Error"
Cancel = True
Case Else
' unknown error
MsgBox Err.Description, vbExclamation, "Error"
Cancel = True
End Select
End If

End Sub

Put the same code in the year and months controls' BeforeUpdate event
procedures also, as a user could enter a valid month and day such as 03 and
31, but then change the month to 02, or enter a valid leap year date such as
200-02-29 and then change the year to 2001.

Ken Sheridan
Stafford, England

eda wrote:
>Hello,
>
>I'm adding a new field to a table to hold a date. The field must be
>able to except input in all three of the following ways:
>
>yyyy (just the year, without month or day)
>yyyy-mm (just the year and month, without the day) or
>yyyy-mm-dd (year, month, and date)
>
>Since usually it would just hold the year, it doesn't have to be a
>DATE data type, it can be TEXT. However, I don't know how to create a
>format or input mask where everything past the yyyy is optional. I
>guess I could leave it without any format or input mask and just use a
>validation rule, but I can't figure out how to make that work either.
>Can anyone help?

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access/200911/1

eda <ikh1@corne
NewsGroup User
Re: Properties - Format, Input Mask, Validation Rule11/10/2009 9:08:09 PM
Reply

0

Another wonderful idea! Thanks!

On Nov 10, 2:34=A0pm, "KenSheridan via AccessMonster.com" <u51882@uwe>
wrote:
> Have you considered using three separate fields for the year, month a day=
-of-
> month? =A0Its always easier to combine values from separate fields than t=
o
> parse a single value, and it would make the formatting and input masks ea=
sier
> to set up. =A0On a form you can use three contiguous text boxes with a hy=
phen
> character between each as labels. =A0You =A0could include some validation=
code in
> the day-of-month control's BeforeUpdate EventProcedure to test for an inv=
alid
> date, e.g.
>
> Private Sub txtDay_BeforeUpdate(Cancel As Integer)
>
> =A0 =A0 Const BAD_DATE =3D 13
> =A0 =A0 Const MESSAGETEXT =3D "Invalid date"
> =A0 =A0 Dim dtmDate As Date
>
> =A0 =A0 If Not IsNull(Me.txtDay) Then
> =A0 =A0 =A0 =A0 On Error Resume Next
> =A0 =A0 =A0 =A0 dtmDate =3D CDate(Me.txtYear & "-" & Me.txtMonth & "-" & =
Me.txtDay)
> =A0 =A0 =A0 =A0 Select Case Err.Number
> =A0 =A0 =A0 =A0 =A0 =A0 Case 0
> =A0 =A0 =A0 =A0 =A0 =A0 ' no error
> =A0 =A0 =A0 =A0 =A0 =A0 Case BAD_DATE
> =A0 =A0 =A0 =A0 =A0 =A0 MsgBox MESSAGETEXT, vbExclamation, "Error"
> =A0 =A0 =A0 =A0 =A0 =A0 Cancel =3D True
> =A0 =A0 =A0 =A0 =A0 =A0 Case Else
> =A0 =A0 =A0 =A0 =A0 =A0 ' unknown error
> =A0 =A0 =A0 =A0 =A0 =A0 MsgBox Err.Description, vbExclamation, "Error"
> =A0 =A0 =A0 =A0 =A0 =A0 Cancel =3D True
> =A0 =A0 =A0 =A0 End Select
> =A0 =A0 End If
>
> End Sub
>
> Put the same code in the year and months controls' BeforeUpdate event
> procedures also, as a user could enter a valid month and day such as 03 a=
nd
> 31, but then change the month to 02, or enter a valid leap year date such=
as
> 200-02-29 and then change the year to 2001.
>
> Ken Sheridan
> Stafford, England
>
>
>
> eda wrote:
> >Hello,
>
> >I'm adding a new field to a table to hold a date. =A0The field must be
> >able to except input in all three of the following ways:
>
> >yyyy =A0 (just the year, without month or day)
> >yyyy-mm =A0 (just the year and month, without the day) =A0or
> >yyyy-mm-dd =A0 (year, month, and date)
>
> >Since usually it would just hold the year, it doesn't have to be a
> >DATE data type, it can be TEXT. =A0However, I don't know how to create a
> >format or input mask where everything past the yyyy is optional. =A0I
> >guess I could leave it without any format or input mask and just use a
> >validation rule, but I can't figure out how to make that work either.
> >Can anyone help?
>
> --
> Message posted via AccessMonster.comhttp://www.accessmonster.com/Uwe/Foru=
ms.aspx/access/200911/1

5 Items, 1 Pages 1 |< << Go >> >|







Similar:

remove an incorrectly entered primary domain - hmc 3.5

there is no such object on the server./adsgetobject/getproperties

distribution list entries

mps sdk beta 1 sample provider issue

finding out storage currently used by mailbox

mps provtest tool error

delete user mailbox in hmc 3.5

journal folder is not available in owa premium

owa junk email in ex2007

problem with mailenablecontact

error using sample scripts with provtest

getmailboxpermissions

hmc 3.5 setup, procedure dwspv.20

mps across domains?

security settings problem

sharepoint site creation timeouts

hmc 4.0 and .net 3.0

extending hmc 4.0 samplewebui control panel

file system provider (core providers)

hmc 4.0 : documented method missing in the web service ??

procedure movemailbox

hosted iss namespace issue

wbh 4.5 - can't create customer sharepoint site

oab migration error

error addiisresources:

reporting error

how is al and gal used by mps

mps from mps1.0 to mps2.0?

reset password in all ad and servers

getting unknown error (0x8000500c) while creating new mailbox

creating mailbox enabled user accounts

mps (wbh 3.5) on a single server (test-setup) - webservice install fails miserable!

pwdb transaction log is huge!

how can i remove a hostedexchange plan from database?

determine if user is on reseller/customer/user role

how to install mps?

index was out of range. must be non-negative and less than the size of the collection.

error 1603 - sql problems?

new to microsoft provisioning system

mps client

can't creat mailbox in hmc 4.0: the object exists. cmdlet='new-offlineaddressbook' domaincontroller...

enabling exchange hosting error

mps 3.5 installation

mps installtion and setup for visual studio 2005

no serviceplans available for consumers

failed getting remote comserverpath and frontpage provider

errorcontext description="access is denied." code="0x80070005" executeseqno="0"

deploymenttool.msi problem

windows based hosting 3.0 release date?

provisioning server firewall rules

   
  Privacy | Contact Us
All Times Are GMT