Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Nov 2001
    Thanked 0 Times in 0 Posts

    Create input mask in remote DB (Access 2000)

    I have a function that creates a field and it works perfeclty well except for the line defining the input mask, which obviusly is not done properly by me.The line is the following
    fld.Properties("InputMask") = "=99.99.00;0()"
    Could somebody tell me where i am wrong ?
    The whole code is below:

    Dim StrPassword As String
    StrPassword = "secret"

    Dim wsp As DAO.Workspace
    Dim dbs As DAO.Database
    Dim tdf As DAO.TableDef
    Dim fld As DAO.Field
    Dim prp As DAO.Property
    Dim idx As DAO.Index
    Set wsp = DAO.DBEngine.Workspaces(0)
    Set dbs = wsp.OpenDatabase("C:BEstoreBE.mdb", False, False, ";PWD=" & StrPassword)

    Set tdf = dbs.TableDefs("CallsClients")
    Set fld = tdf.CreateField("CallDate", dbDate)
    tdf.Fields.Append fld

    ' set additional field properties
    Set fld = tdf.Fields("CallDate")
    fld.Properties("InputMask") = "=99.99.00;0()"
    Set prp = fld.CreateProperty("Format", dbText, "Short Date")
    fld.Properties.Append prp

    Set prp = Nothing
    Set idx = Nothing
    Set fld = Nothing
    Set tdf = Nothing
    Set dbs = Nothing
    Set wsp = Nothing

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: Create input mask in remote DB (Access 2000)

    1. An input mask is not an expression, so it should not start with =
    2. An input mask is not a function, so it should not end with ()
    3. An input mask must conform to US notation if you set it in VB. You can't use the decimal point twice; you probably want to use the thousands separator (a comma).
    3. Just like you do with the Format property, you must create the InputMask property if you haven't done so before.

    Set prp = fld.CreateProperty("InputMask", dbText, "99,99,00;0")
    fld.Properties.Append prp

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts