[AccessD] Short Date Input Mask question

Arthur Fuller artful at rogers.com
Fri Mar 19 23:10:53 CST 2004


Thanks Bryan! Yo Canada!

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bryan
Carbonnell
Sent: Wednesday, March 17, 2004 6:12 AM
To: accessd at databaseadvisors.com
Subject: RE: [AccessD] Short Date Input Mask question


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





More information about the AccessD mailing list