[AccessD] Short Date Input Mask question

Bryan Carbonnell Bryan_Carbonnell at cbc.ca
Wed Mar 17 08:12:02 CST 2004


Well, here is a start for the tables Arthur. Can't help wiht the forms
though.

First off, set a reference to DAO and add the following sub.

It will get rid of the InputMasks in all the tables. I only tested it
against local tables, so linked tables may or may not work. IF these
changes are going to be distributed to and end user's site and you can't
get at the "working" data, you may want to have a look at the BEU.

Anyway, here is the code:

Sub ClearInputMask()

Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim fld As DAO.Field

Set db = CurrentDb()

'Looop through all the tabledefs
For Each tdf In db.TableDefs
  'loop through all the fields in the tabledef
  If Left$(tdf.Name, 4) <> "Msys" Then
    For Each fld In tdf.Fields
      'See if the field is a date field
      If fld.Type = dbDate Then
        'A date/time field
        'Ignore errors, because one will be generated if there
        ' is no input mask defined
        On Error Resume Next
        fld.Properties.Delete "InputMask"
      End If
    Next
  End If
Next

Set fld = Nothing
Set tdf = Nothing
Set db = Nothing
End Sub

Bryan Carbonnell
bryan_carbonnell at cbc.ca

>>> artful at rogers.com 17-Mar-04 1:21:42 AM >>>
So the question becomes, how can I null all the date-field masks that
I
embedded so carefully, in both the numerous tables and all the forms?
I
want to walk the list of tables and wipe out the masks for all date
fields, then do the same to all the forms. There are way too many to
do
by hand.

I tried running Rick Fisher's Find and Replace to do this and got
numerous error messages saying "User defined properties do not support
a
null value".

So I replaced the masks with " " and although Rick's tool warned me
that
I was inserting a trailing space, it worked perfectly. Kewl!

Arthur

-----Original Message-----
From: accessd-bounces at databaseadvisors.com 
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart
McLachlan
Sent: Tuesday, March 16, 2004 2:06 PM
To: Access Developers discussion and problemsolving
Subject: Re: [AccessD] Short Date Input Mask question


On 16 Mar 2004 at 14:47, Arthur Fuller wrote:

> The standard short date input mask (99/99/0000;0;_) has a shortcoming

> that I hate: you have to type 04/04/04 to get April 4th 2004. The
year

> handling is nice but the month and day suck. The mask won't let you 
> type 4/4/04. Is there an alternative mask that will respond 
> intelligently to such input? Or should I instead just remove all the

> input masks from all the date fields?
> 
I gave up using date input masks long ago, they are a PITA.

A lot of date entry tends to be for the current year and it's so 
simple to just enter 4/4 using the numieric keypad.

-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com 
http://databaseadvisors.com/mailman/listinfo/accessd 
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list