Results 1 to 3 of 3

Thread: Error in calculated field in selection query

  1. #1
    Join Date
    Dec 2008
    Posts
    37

    Error in calculated field in selection query

    Hi
    I am getting #error as the result of a calculated field.

    I am using the following to calculate a subscription rate in a select query:

    newsub: CCur(DLookUp("[Subscription]","Subscription Rates Sort","([Effective-Date] <= " & DateAdd("yyyy",3,[Date-Registered]) & ")"))

    [Effective-Date] is in Subscription Rates Sort and [Date-Registered] is in the table the query is based on.

    Any Ideas?

    Regards
    Tony Randell

  2. #2
    Join Date
    Oct 2006
    Location
    Maitland NSW Australia
    Posts
    275
    The Date-Registered needs to be enclose by the # as in the example below.

    "[real_date] = #" & Format(Date, "mm/dd/yyyy") & "#")

    Also, I do not know if you can use <= in a dlookup
    Allan

  3. #3
    Join Date
    Dec 2008
    Posts
    37
    Hi

    Following your advice I created a calculated field (newsub) using the amended expression:

    newsub: CCur(DLookUp("[Subscription]","Subscription Rates Sort","([Effective-Date] <= #" & DateAdd("yyyy",3,[Date-Registered]) & "#)"))

    It works just fine - I was worried about the use of CCur, Dlookup and DateAdd together - but it does work.

    Thanks and Regards

    Tony Randell

Posting Permissions

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