Results 1 to 4 of 4
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help with DLookup? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    The following code works if there is a date in dtmInsExpDate

    If dtmInsExpDate isblank or null I want it to be equal to today

    Thanks, John

    <pre> If Nz(Format(DLookup("dtmInsExpDate", "tblContractor", _
    "lngContractorID =" & ID), "yyyymmdd"), Format(Date, "yyyymmdd")) _
    < Format(Date, "yyyymmdd") Then
    </pre>


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

    Re: Help with DLookup? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    Try
    <code>
    If Nz(DLookup("dtmInsExpDate", "tblContractor", _
    "lngContractorID =" & ID), Date) < Date Then
    </code>
    All those formats aren't needed, and since Format(...) doesn't ever result in Null, it doesn't help to apply Nz to it.

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Help with DLookup? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    Good news and bad news

    Good news - it works
    Bad news - I was getting paid by number of lines of code

    Thanks, John

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

    Re: Help with DLookup? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    You can always insert extra line continuation characters and line breaks... <img src=/S/evilgrin.gif border=0 alt=evilgrin width=15 height=15>

Posting Permissions

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