473,320 Members | 2,012 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,320 software developers and data experts.

DLookup & ComboBox

Hi, I have a table called Tbl_ComboBox, and a form named Form1. On the form I have a combobox where you select an employee code. I need to do a DLookUp from an Unbound text box to auto fill the Name of person that is equal to my selected Combobox value. This is what I have:

=DLookUp("[Name]","[Tbl_ComboBox]","[Employee Code].[Tbl_ComboBox]= " & [Combo2].[Text]). Not working. What am I missing? Please help
Sep 28 '15 #1

✓ answered by Seth Schrock

Try changing it to
Expand|Select|Wrap|Line Numbers
  1. =DLookUp("[Name]","[Tbl_ComboBox]","[Employee Code]= " & Forms!Your_Form_Name![Combo2])
If Employee code is a text field, then it would need to be like this:
Expand|Select|Wrap|Line Numbers
  1. =DLookUp("[Name]","[Tbl_ComboBox]","[Employee Code]= '" & Forms!Your_Form_Name![Combo2] & "'")

3 7322
Seth Schrock
2,965 Expert 2GB
Try changing it to
Expand|Select|Wrap|Line Numbers
  1. =DLookUp("[Name]","[Tbl_ComboBox]","[Employee Code]= " & Forms!Your_Form_Name![Combo2])
If Employee code is a text field, then it would need to be like this:
Expand|Select|Wrap|Line Numbers
  1. =DLookUp("[Name]","[Tbl_ComboBox]","[Employee Code]= '" & Forms!Your_Form_Name![Combo2] & "'")
Sep 28 '15 #2
hvsummer
215 128KB
As Seth said, you miss the ' out side text field condition.
beside that, if you want to call out value of combo box, you should use me!combobox as condition for looking field.

but I suggest you create combobox with rowsource
Expand|Select|Wrap|Line Numbers
  1. SELECT EmployeeCode, EmployeeName from Tbl_ComboBox
then set combobox column count property to 2, bound column to 1
then set text box control source like this
Expand|Select|Wrap|Line Numbers
  1. =comboboxEmployeeCode.column(1)
you'll have problem resolved.
Sep 29 '15 #3
Thank you Seth and hvsummer....It is working perfectly now!!!!
Sep 29 '15 #4

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

Similar topics

5
by: Kalvin Schroder | last post by:
I am fairly new to Access, and am trying to put together an invoice form. The main form in called InvoiceDetailFm. Source is the table InvoiceDetail and has invoice number, saleman, and CustID as...
3
by: Tripp Knightly | last post by:
I have a lookup table from which I want to categorize various bands of customer net income. Some of the income is positive, some is negative. The bands vary in size (ie, <500, -200 to 0, 100 to...
1
by: francesco | last post by:
Hi, I have a combobox and I bind it with a dataset I display one field of the dataset SqlDataAdapter1.Fill(DsDataSet) ComboBox.DataSource = DsDataSet(0) ComboBox.DisplayMember =...
1
by: Ken Yu | last post by:
Hi, How can create image in ListView and ComboBox ? tks a lot ! Ken
1
by: reidarT | last post by:
I have a bound combobox and a datagridview on a form. When I select from the combobox, I want the list in the datagrid to refresh and show appropriate data with criteria from the combobox (i.e....
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...
2
tuxalot
by: tuxalot | last post by:
Simple question I'm sure. I have a combobox listing various company names. Below the combobox there are address, city and state boxes. When a person selects a company, can I have the address city...
0
by: Terry Smith | last post by:
The following is the current code for the export button on my app; private void btnExport_Click(object sender, EventArgs e) { string filename; filename...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
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...
1
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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.