Solved

Dlookup

Posted on 2013-02-06
11
476 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
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…
Familiarize people with the process of utilizing SQL Server stored procedures 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 Micr…

828 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