Results 1 to 2 of 2
  1. #1
    Lounger
    Join Date
    Aug 2002
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    overflow (Access 2000)

    I have built a function, to create a field in the table Customers,
    called TurnDown, with Yes/No options and having the
    following properties:

    Format : Yes/No
    DefaultValue : False
    Index : OK

    I can build all these properties in the field TirnDown,only the property
    format create me problems: receive error message : overflow" and
    the line under question is the following
    Set prp = fld.CreateProperty("Format", Yes / No)

    Can somebody help me ?
    Below is the entire function

    Public Function OnOrders()
    Dim dbs As Database
    Set dbs = CurrentDb

    Set tdf = dbs.TableDefs("Customers")
    Set fld = tdf.CreateField("TurnDown", dbBoolean)

    tdf.Fields.Append fld
    tdf.Fields.Refresh


    ' set additional field properties
    Set fld = tdf.Fields("TurnDown")
    fld.Properties("DefaultValue") = "= False"
    Set prp = fld.CreateProperty("Format", Yes / No)

    fld.Properties.Append prp

    ' create and append index
    Set idx = tdf.CreateIndex("TurnDownIdx")
    idx.Fields.Append idx.CreateField("TurnDown")
    idx.Unique = False
    tdf.Indexes.Append idx

    dbs.Close
    Set prp = Nothing
    Set idx = Nothing
    Set fld = Nothing
    Set tdf = Nothing
    Set dbs = Nothing
    Set wsp = Nothing
    End Function

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: overflow (Access 2000)

    1. You haven't specified a type for the property
    2. You should use a string "Yes/No" as value. Your expression Yes / No is seen as division of two variables Yes an No; since you haven't given these a value, it is evaluated as 0 / 0 and this causes an overflow error.

    Use

    Set prp = fld.CreateProperty("Format", dbText, "Yes/No")

Posting Permissions

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