Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Another #Error question

Discussion in 'Information Technology' started by lmv, Jul 28, 2006.

Tags:
  1. lmv

    lmv
    Expand Collapse
    Guest

    I am using
    =DLookUp("[ProductName]","[ProductsTTL]","[ProductId]=" & [CALHProductID])

    I tried =Nz(DLookUp("[ProductName]","[ProductsTTL]","[ProductId]=" &
    [CALHProductID]))

    But it didn't work to supress the #Error in the new record field and in any
    field that doesn't have a value

    Tried changing the CALHProductID which is a number to default value 0 and
    then put nothing in default value but nothing changes it.

    Any suggestions?
    Thanks!!
     
  2. Loading...

    Similar Threads Forum Date
    Sikhism More Than Just Another Religion New to Sikhism Jul 25, 2016
    Yet Another Show Of Support For Sikhs From Canada! Breaking News Apr 28, 2016
    Another funny story, and Rory is castrated Blogs Oct 17, 2015
    Another week, another wolf Blogs Oct 17, 2015
    easy, develop another addiction! Blogs Oct 16, 2015

  3. Allen Browne

    Allen Browne
    Expand Collapse
    Guest

    If you open this table in design view, what type of field is ProductID?

    a) Number field (including AutoNumber):
    ===============================
    When CALHProductID is null, the 3rd argument resolves to:
    [ProductId] =
    Naturally, that's not correctly formed. To avoid the error, use Nz() to
    supply some value so the 3rd string is complete. Example:
    =DLookUp("ProductName", "ProductsTTL", "[ProductId] = " &
    Nz([CALHProductID],0))

    b) Text field:
    =========
    You need to add quote delimters around the value you are concatenating into
    the 3rd argument:
    =DLookUp("ProductName", "ProductsTTL", "[ProductId]=""" & [CALHProductID] &
    """")

    c) ProductId and CALHProductID are different types.
    ========================================
    This is not going to work. You are matching apples against oranges.

    d) No records in the form
    ===================
    A special problem arises in a form when there is no data, and no new records
    can be added. The detail section goes completely blank, and any controls in
    other sections are likely to generate #Error. More info:
    http://allenbrowne.com/bug-06.html

    --
    Allen Browne - Microsoft MVP. Perth, Western Australia.
    Tips for Access users - http://allenbrowne.com/tips.html
    Reply to group, rather than allenbrowne at mvps dot org.

    "lmv" <lmv@discussions.microsoft.com> wrote in message
    news:743A380C-672E-4CCD-B91E-6B46D7ED87A5@microsoft.com...
    >I am using
    > =DLookUp("[ProductName]","[ProductsTTL]","[ProductId]=" & [CALHProductID])
    >
    > I tried =Nz(DLookUp("[ProductName]","[ProductsTTL]","[ProductId]=" &
    > [CALHProductID]))
    >
    > But it didn't work to supress the #Error in the new record field and in
    > any
    > field that doesn't have a value
    >
    > Tried changing the CALHProductID which is a number to default value 0 and
    > then put nothing in default value but nothing changes it.
    >
    > Any suggestions?
    > Thanks!!
     
  4. lmv

    lmv
    Expand Collapse
    Guest

    Once again, Thank you for the correct answer and the REASON...!
    It is so much more helpful to understand WHY something is happening rather
    than just how to fix it.

    lmv

    "Allen Browne" wrote:

    > If you open this table in design view, what type of field is ProductID?
    >
    > a) Number field (including AutoNumber):
    > ===============================
    > When CALHProductID is null, the 3rd argument resolves to:
    > [ProductId] =
    > Naturally, that's not correctly formed. To avoid the error, use Nz() to
    > supply some value so the 3rd string is complete. Example:
    > =DLookUp("ProductName", "ProductsTTL", "[ProductId] = " &
    > Nz([CALHProductID],0))
    >
    > b) Text field:
    > =========
    > You need to add quote delimters around the value you are concatenating into
    > the 3rd argument:
    > =DLookUp("ProductName", "ProductsTTL", "[ProductId]=""" & [CALHProductID] &
    > """")
    >
    > c) ProductId and CALHProductID are different types.
    > ========================================
    > This is not going to work. You are matching apples against oranges.
    >
    > d) No records in the form
    > ===================
    > A special problem arises in a form when there is no data, and no new records
    > can be added. The detail section goes completely blank, and any controls in
    > other sections are likely to generate #Error. More info:
    > http://allenbrowne.com/bug-06.html
    >
    > --
    > Allen Browne - Microsoft MVP. Perth, Western Australia.
    > Tips for Access users - http://allenbrowne.com/tips.html
    > Reply to group, rather than allenbrowne at mvps dot org.
    >
    > "lmv" <lmv@discussions.microsoft.com> wrote in message
    > news:743A380C-672E-4CCD-B91E-6B46D7ED87A5@microsoft.com...
    > >I am using
    > > =DLookUp("[ProductName]","[ProductsTTL]","[ProductId]=" & [CALHProductID])
    > >
    > > I tried =Nz(DLookUp("[ProductName]","[ProductsTTL]","[ProductId]=" &
    > > [CALHProductID]))
    > >
    > > But it didn't work to supress the #Error in the new record field and in
    > > any
    > > field that doesn't have a value
    > >
    > > Tried changing the CALHProductID which is a number to default value 0 and
    > > then put nothing in default value but nothing changes it.
    > >
    > > Any suggestions?
    > > Thanks!!

    >
    >
    >
     

Share This Page