Welcome to SPN

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

Sign Up Now!
  1. Monthly (Recurring) Target: $300 :: Achieved: $95
      Become a Supporter    ::   Make a Contribution   

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!!

    >
    >
    >
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page