Results 1 to 10 of 10
  1. #1
    4 Star Lounger
    Join Date
    May 2002
    Location
    Roanoke, Virginia, USA
    Posts
    493
    Thanks
    0
    Thanked 0 Times in 0 Posts

    changing a field to null (A2K SP 3)

    I have a form in which I have a Before Update event that tests a set of conditions to determine whether a value can be entered into field

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

    Re: changing a field to null (A2K SP 3)

    Is this the Before Update event of the TrfTo control or of the form?

  3. #3
    4 Star Lounger
    Join Date
    May 2002
    Location
    Roanoke, Virginia, USA
    Posts
    493
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: changing a field to null (A2K SP 3)

    TrfTo control.

    Tom

  4. #4
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: changing a field to null (A2K SP 3)

    Should =Null not be ="" (Open quote close quote) Assuming its a text field!
    Regards,
    Rudi

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

    Re: changing a field to null (A2K SP 3)

    You cannot change the value of a control in its Before Update event. You could use

    Cancel = True
    Me.TrfTo.Undo

    in the Before Update event of TrfTo, or you could move the code to the Before Update event of the form.

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

    Re: changing a field to null (A2K SP 3)

    No, setting a text field to Null completely clears it. If you set it to "", a test on Is Null will not find the record.

  7. #7
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: changing a field to null (A2K SP 3)

    OK...thx for that!
    So what is ""? An empty string? And how does that differ from Null as I thought "" is just as good!

    PS: Sorry for pirating this thread!
    Regards,
    Rudi

  8. #8
    4 Star Lounger
    Join Date
    May 2002
    Location
    Roanoke, Virginia, USA
    Posts
    493
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: changing a field to null (A2K SP 3)

    Hans,

    Many thanks. The Undo does what I want.

    Tom

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

    Re: changing a field to null (A2K SP 3)

    Null and the empty string <code>""</code> are not the same. If a field is Null, it is completely blank, it has no value at all. If a field is <code>""</code>, it does have a value, albeit an empty-looking one.

    Say that you create a query and set the criteria for the TrfTo field to <code>Like "*"</code>. Records for which TrfTo is <code>""</code> will be returned by this query, but records for which TrfTo is Null will NOT be returned, for <code>"*"</code> means "any value, even an empty string", but Null is not a value, it's the absence of a value. For the same reason, a query with <code>Is Null</code> as criteria for the TrfTo field will return records for which TrfTo is Null, but NOT records for which TrfTo is <code>""</code>.

  10. #10
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: changing a field to null (A2K SP 3)

    Well i just learned something new...albeit nothing!! <img src=/S/laugh.gif border=0 alt=laugh width=15 height=15>
    Tx Hans for " * "
    Regards,
    Rudi

Posting Permissions

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