Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Dlookup

Posted on 2013-02-06
11
Medium Priority
?
513 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 3
11 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 1000 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 1000 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
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

596 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