Professional Web Applications Themes

Look for date data in field - Microsoft Access

I want to look to a table and see if there is a specific date in that field. If there is then do one thing and if not do another. I did a dlookup (trying to get a null value or string value) and got an error that the data type did not match. I saw another post that the date need to be formated but when I tried to do that I got errors on that as well. varX = DLookup("biLstNam", "[tblBilling]", "biDate='" & Me.txbBillingDate & "'") What am I doing wrong or is there a better way to ...

  1. #1

    Default Look for date data in field

    I want to look to a table and see if there is a specific date in that field.
    If there is then do one thing and if not do another.

    I did a dlookup (trying to get a null value or string value) and got an
    error that the data type did not match. I saw another post that the date
    need to be formated but when I tried to do that I got errors on that as
    well.

    varX = DLookup("biLstNam", "[tblBilling]", "biDate='" & Me.txbBillingDate &
    "'")

    What am I doing wrong or is there a better way to do this?


    Thanks,
    Ken


    Ken Guest

  2. #2

    Default Re: Look for date data in field

    varX = DLookup("biLstNam", "[tblBilling]",
    "biDate=#" & Me.txbBillingDate & "#")

    Dates are delimited with # characters. Also, Access expects date strings to be
    in mm/dd/yyyy format.

    Another way to do this:
    varX = DLookup("biLstNam", "[tblBilling]",
    "biDate=" & Format(Me.txbBillingDate,"\#mm\/dd\/yyyy\#"))

    Ken Ivins wrote: 
    John Guest

  3. #3

    Default Re: Look for date data in field

    John,

    I had seen the second solution and had trouble with that as well. But your
    first solution worked fine and did what I needed

    Thanks for your help,
    Ken

    "John Spencer (MVP)" <net> wrote in message
    news:net... 
    to be [/ref]
    field. [/ref]
    Me.txbBillingDate & [/ref]


    Ken Guest

Similar Threads

  1. Outputting data using date field
    By DDhillon in forum Coldfusion Database Access
    Replies: 5
    Last Post: April 19th, 05:38 PM
  2. Date comparison in a text data field
    By Ad Bec in forum Coldfusion Database Access
    Replies: 5
    Last Post: September 30th, 02:29 AM
  3. Comparing current field data with last entry for field
    By ccnorris in forum Coldfusion - Advanced Techniques
    Replies: 8
    Last Post: June 1st, 03:20 AM
  4. Converting a text field to a date field - FM6
    By Carl Mittler in forum FileMaker
    Replies: 2
    Last Post: October 17th, 09:38 PM
  5. Linking date field to text field entry
    By Trey in forum Microsoft Access
    Replies: 1
    Last Post: July 16th, 07:35 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139