Solved

Retrieve information from table in an unbound text box

Posted on 2011-02-22
10
280 Views
Last Modified: 2012-05-11
Hi all,

What would I set an unbound text box control source to in order to get the third column from tbl_table1 where the text box employee matches the employee name in the table?

If there is nothing in the column then it should just remain blank.

Thanks

Chris
0
Comment
Question by:smods
[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
  • 5
  • 5
10 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 34952077
use a dlookup() function

=nz(dlookup("ColumnName","tbl_table1","EmployeeName='" & me.textEmployeeName & "'"))
0
 

Author Comment

by:smods
ID: 34952236
Thanks capricorn1

The text box is just returning #Name?

I can't work out why.  I've amended the code as per my field names

=nz(DLookUp("Employee_Number","tbl_CashierDetails","Cashier='" & me.textCashier & "'"))
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 34952340
sorry

=nz(DLookUp("Employee_Number","tbl_CashierDetails","Cashier='" & Forms!NameOfForm!textCashier & "'"))


change nameOFForm with the actual name of the form
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:smods
ID: 34952491
No worries! I have done this and it works when you open the subform directly but not when you open the main form that the subform is in.  I still get #Name?

What would be the reason for this?

Regards

Chris
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 34952617
i didn't see you mentioned a subform in your original post..??
0
 

Author Comment

by:smods
ID: 34952716
Grrr, my bad! Sorry

Is there a way around this?  Points increased to 500
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 34952776
ok,

where is the textbox that you want to display the  "Employee_Number" located?
where is the textbox  "textCashier" located?

what is the name of Main form? the name of the subform?
0
 

Author Comment

by:smods
ID: 34952911
The text box where I want to display the employee number is on the subform.

The text box textCashier is also located on the subform.

The main form is called frm_New_KPI_Main

The subform in the main database window is called frm_New_KPI_Sub but the actual name of the subform when viewed inside the main form is called frm_KPI_Sub

Regards

Chris
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 34953015
test this

=nz(DLookUp("Employee_Number","tbl_CashierDetails","Cashier='" & Forms![frm_New_KPI_Main]![frm_KPI_Sub].Form!textCashier & "'"))
0
 

Author Closing Comment

by:smods
ID: 34953075
Brilliant

Thanks
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

730 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