Solved

Dlookup

Posted on 2013-02-06
11
482 Views
Last Modified: 2013-02-06
Hello, I just cant seem to get my head around this. I have it working in one form but then using the same syntax it does not work in another. Please help.
Ideally i want to lookup to criteria to then get me result but am just trying to get it working using one criteria.

=DLookUp("[rftotal]","[ringfencedstock]","[offerref]=" & [Forms]![offermain]![ref])

rftotal is a numeric field

Thanks for any help.
Iain
0
Comment
Question by:iainmacleod
  • 4
  • 3
  • 3
11 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 250 total points
ID: 38859511
i don't see anything wrong with your dlookup

did you check the name of the fields and controls

if [offerref] is text

=DLookUp("[rftotal]","ringfencedstock","[offerref]='" & [Forms]![offermain]![ref] & "'")
0
 
LVL 61

Assisted Solution

by:mbizup
mbizup earned 250 total points
ID: 38859515
The important datatype here is offerref.

If that is text...

=DLookUp("[rftotal]","[ringfencedstock]","[offerref]='" & [Forms]![offermain]![ref] & "'")
0
 

Author Comment

by:iainmacleod
ID: 38859673
Thank you both, you were spot on. The offerref is text. I have added what you sent and that works a treat. Could you also help me with the second critera,

And "[stockcode]='" & [Forms]![offermain]![offersubform]![stockcode] & "'"

Many thanks
0
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
LVL 61

Expert Comment

by:mbizup
ID: 38859690
Try this:

=DLookUp("[rftotal]","[ringfencedstock]","[offerref]='" & [Forms]![offermain]![ref] & "' And [stockcode]='" & [Forms]![offermain]![offersubform]![stockcode] & "'")

Open in new window

0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38859701
try this


=DLookUp("[rftotal]","ringfencedstock","[offerref]='" & [Forms]![offermain]![ref] & "' and [stockcode]='" & [Forms]![offermain]![offersubform]![stockcode] & "'")
0
 

Author Comment

by:iainmacleod
ID: 38859703
That is excellent, thanks very much. I now have a great template for future....
0
 

Author Comment

by:iainmacleod
ID: 38859708
I hope i have done the right thing with the points...?
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38859720
;-)
0
 
LVL 61

Expert Comment

by:mbizup
ID: 38859739
Iain -

Since that second question was not really part of the original post, perhaps an even point split would be more equitable (right now, I've got the lion's share)?  I can fix that for you if  you want... (or use the Request Attention button)
0
 

Author Comment

by:iainmacleod
ID: 38859755
If you could fix that I would appreciate it. You have both helped me out in the past as well... - thanks
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question