By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,853 Members | 974 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,853 IT Pros & Developers. It's quick & easy.

DLookup & Cross-Tab

P: 2
Hello Everyone!

[AdminEdit]This question was split from an original found at The Dreaded DLookup[/AdminEdit]

...

My second DLookup is a bit more complicated, and why I thought taking a step back to a simpler dlookup function would help me to understand dlookups better, hence the first dlookup. Again, I am using the "Control Source" in Access where my code looks like the below:
Expand|Select|Wrap|Line Numbers
  1. =DLookup("Time","Travel","StartNode = ' " & [StartNode] & " '  and EndNode = ' " & [EndNode] & " ' ")
While I don't get an error, but I am not getting a value either. The "Time" value that I am trying to return is the intersection of two user entered values, similar to the attached table named "tbl".

I'm a bit lost and my Mt. Dew is running low. Please help.

Attached Images
File Type: png tbl.PNG (55.2 KB, 103 views)
Apr 19 '19 #1
Share this Question
Share on Google+
3 Replies


NeoPa
Expert Mod 15k+
P: 31,310
It's very unclear what you're working with as the illustration doesn't match the code in any way shape or form.

However, assuming there's any sense in there at all, you will struggle to match values if you keep throwing extraneous spaces into strings in your code. If it matches the string value then it certainly won't match that same string value after spaces have been added as you have in your code.

It should look more like (I make no guarantees mind, as I'm mainly guessing at what we're working with.) :
Expand|Select|Wrap|Line Numbers
  1. =DLookup("[Time]","[Travel]","([StartNode]='" & [StartNode] & "') AND ([EndNode]='" & [EndNode] & "')")
Apr 20 '19 #2

twinnyfo
Expert Mod 2.5K+
P: 3,158
Mickey,

Is that image a “real” table or a spreadsheet or something else? It is unclear how you could use a DLookup on what you have with the syntax you’ve posted.
Apr 20 '19 #3

NeoPa
Expert Mod 15k+
P: 31,310
Thank you Twinny. Either that makes absolutely no sense or I'm going mad. Either was possible TBF :-D

@DivingMickey.
I know almost everything we've said so far has been criticism of how you've posted, but don't take that to heart. Think of it as guidance rather than any indication you don't fit here. Obviously pay attention to the comments and learn from them, but don't assume we're either hostile or already impatient with you. We just need to get things on a workable footing ASAP. We look forward to your next post that will hopefully make your question and your need clearer.
Apr 20 '19 #4

Post your reply

Sign in to post your reply or Sign up for a free account.