473,323 Members | 1,537 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

DLookup(VARIABLE, domain [, criteria] )

Hi There,

Basically I have a form with a Combo box on it, with 20 options. Each option is a field name in table1

I then have a query that needs to take the selected field name and perform a look up
ie:
DLookup("Form![formname]![Combo1]","Table1","ID=" &[ID2])

Im not sure if this is posible, If not can anyone think of a work around?

Thanks
D
Jun 19 '07 #1
3 2128
Rabbit
12,516 Expert Mod 8TB
Hi There,

Basically I have a form with a Combo box on it, with 20 options. Each option is a field name in table1

I then have a query that needs to take the selected field name and perform a look up
ie:
DLookup("Form![formname]![Combo1]","Table1","ID=" &[ID2])

Im not sure if this is posible, If not can anyone think of a work around?

Thanks
D
Take the quotes off Form![formname]![Combo1]
Jun 19 '07 #2
Thanks for your reply, however im still having no luck.

It is simply outputting what is selected in the drop down box, and not the actual field i need it to look up.

Thanks anyway.

D
Jun 20 '07 #3
Rabbit
12,516 Expert Mod 8TB
Thanks for your reply, however im still having no luck.

It is simply outputting what is selected in the drop down box, and not the actual field i need it to look up.

Thanks anyway.

D
Try Forms!FormName!Combo1

I'm also making some assumptions, let me know if any of them are incorrect.

1) Table1 is the name of the table.
2) FormName is the name of the form.
3) Combo1 is the name of the combo box on FormName.
4) ID is the name of a field in Table1.
5) ID is a number.
6) Your query is a saved query.
7) ID2 is the name of a field in Table1.

If all of these are true, then it should work.
Jun 20 '07 #4

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

Similar topics

1
by: KLAU | last post by:
I have a field that retrieves information from an expression in a query. I have used a DLookup function to get the calculated field from the query. However, the relationship is 1-to-many so one...
3
by: Jack | last post by:
What is the syntax for the criteria in DLookup in a subform to refer to a control (MyControl) on the subform? I have tried the following and none seem to work: " = " &...
1
by: jones | last post by:
Everyone, I am trying to tell the report to look up a certain table based on the individuals age. For example if person is Age 55, I would like my dlookup domain to be "Usys Age 55" and this...
2
by: chris.thompson13 | last post by:
I am having a problem setting the criteria part of the DLookup method correctly and am consequently getting an error message. I have a database of staff duties, part of which is a query (qryDaily)...
21
by: Thelma Lubkin | last post by:
I would like my DLookup criteria to say this: Trim(fieldX) = strVar: myVar = _ DLookup("someField", "someTable", "Trim(fieldX) = '" & strVar & '") I don't believe that this will work, and I...
11
by: vkong85 | last post by:
I'm creating a database for work and i've run into a snag. Currently i'm using to nested dlookup statements and they are searching for certain criteria in order to find the correct value the...
2
by: Denise | last post by:
Front end is Access 2002, back end is linked Oracle tables. My users need to describe things in feet and inches and want to use the standard ' and " abbrevations. On a testing form I go to a...
7
Breezwell
by: Breezwell | last post by:
This is probably a simple question for someone out there. I understand that the DLookup function takes has the following syntax: DLookup(expression,domain,) From what I have read, domain can...
4
by: Soulspike | last post by:
Hello all. Currently I am still useing access97 (sad I know) and I can not seem to get this dlookup function in my vb code to work. I keep getting a type mismatch error when I run the code. I...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.