Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Apr 2005
    Location
    Plovdiv
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Null value (Access 2000)

    I want to send a code in another town,but cannot do it.
    In short,I am trying to delete the format of the field PaymentID to Null, however i receive

    the message User defined properties does not support a null value.
    How can i convert it ?

    Here is my code, i am sending also the attachment





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

    Dim prp As DAO.Property
    Dim dbs As DAO.Database
    Set dbs = CurrentDb

    Set tdf = dbs.TableDefs("orders")
    Set fld = tdf.Fields("PaymentID")
    fld.Properties("Format") = ""
    fld.Properties.Append prp

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

    Re: Null value (Access 2000)

    The PaymentID field already has a Format property, so you shouldn't try to append the property again. Instead, you should delete the property:

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

    Set dbs = CurrentDb
    Set tdf = dbs.TableDefs("orders")
    Set fld = tdf.Fields("PaymentID")
    fld.Properties.Delete "Format"

    Set fld = Nothing
    Set tdf = Nothing
    Set dbs = Nothing

  3. #3
    2 Star Lounger
    Join Date
    Apr 2005
    Location
    Plovdiv
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Null value (Access 2000)

    Thank you so much for your reply.I have applied it and it works. As always with your suggestions.
    I want to ask you about an additional problem.This code will be repeatingly sent and sometimes the field may contain
    a format,for example date, and and sometimes not.And if i use the code second time, i receive an error "Item not found
    in this collection"
    May i have a code with both the options to delete if there is something in the format field, and to skip the
    error of the format field is already blank?

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

    Re: Null value (Access 2000)

    You can insert a line

    On Error Resume Next

    immediately above the line that deletes the property.

Posting Permissions

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