Solved

Dlookup

Posted on 2013-02-06
11
469 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
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…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

776 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