Results 1 to 5 of 5
  1. #1
    Star Lounger
    Join Date
    Jun 2003
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts

    strComp in Access (Access XP)

    Hi

    I hope you can help. I am using an Access application with a sql database engine. I need to write detail to a history table so on load I set all the controls tags to be the current value, on save it compares the control value to the control tag and if they are different it writes a row to the history table. The problem I have is that I can't currently get it to write a row when one of the entries is null. Can someone please advise me on what I can do. I have currently used strComp, however if either of the entries is null it brings back a null and I need to know that they are not both null.

    I hope this makes sense but let me know if you need more info.

    Many thanks

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

    Re: strComp in Access (Access XP)

    Problem is that Tag is a string property, and a string cannot be Null. You may be able to get around is by using Nz:
    When loading, use

    ctl.Tag = Nz(ctl.Value, "")

    where ctl stands for a control. When testing, compare Nz(ctl.Value, "") to ctl.Tag.

  3. #3
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: strComp in Access (Access XP)

    Couldn't he also use an If statement, checking for null?

    If Not IsNull(control) Then
    'action
    End If
    ?
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What's more, you deserve to be hacked." -Richard Clarke

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

    Re: strComp in Access (Access XP)

    Yes, that would be possible too, but more work.

  5. #5
    Star Lounger
    Join Date
    Jun 2003
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: strComp in Access (Access XP)

    This has worked, many thanks.

Posting Permissions

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