UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Display A Field From A Table Which Is Not From The Record Source, Access 2016    
 
   
InfoHound
post Nov 20 2019, 06:15 PM
Post#1



Posts: 1,175
Joined: 1-December 12



What is the best way to show the contents of a [Field] from table that is not the Record Source for the Form I'm using?
I want the form to be updateable so I'd prefer to have only the one table as the Record Source.

Example:

I want to show the [EmployeeName] from a table named [tblEmployeeInfo], the form I'm using is based on a table called tblVacations.
The tblVacations has a field called EmpID_FK which is related to the ID field in the [tblEmployeeInfo] table.

In the past I've done two things:
1) I create a recordset that uses SQL statement that looks up the tblEmployeeInfo.ID based on the forms underlying Record Source's Field
[EmpID_FK]. Then I populate the form's corresponding textbox to on what the recordset returns.

2) I use a combo box to capture the EmpID_FK from the tblEmployeeInfo. Hide the first column and show the Employee's name in the combo box.

No. 2 is a lazy way of doing things that works just fine for me, but, the combobox creates issues if someone besides myself is using the program.
No. 1 works great but I'm not sure if it's good (or prefered) programing technique?

Thanks


Go to the top of the page
 
theDBguy
post Nov 20 2019, 06:28 PM
Post#2


UA Moderator
Posts: 76,826
Joined: 19-June 07
From: SunnySandyEggo


Hi. Have you considered using DLOOKUP?

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
InfoHound
post Nov 20 2019, 06:34 PM
Post#3



Posts: 1,175
Joined: 1-December 12



Is this the prefered method that you would use?

Can you return to Field Values? Like : FName & " " & LName?

Thanks
This post has been edited by InfoHound: Nov 20 2019, 06:37 PM
Go to the top of the page
 
theDBguy
post Nov 20 2019, 06:47 PM
Post#4


UA Moderator
Posts: 76,826
Joined: 19-June 07
From: SunnySandyEggo


Hi. Asking for the "best" way isn't always appropriate. Factors like the current situation, database design, computer environment, and personal preferences come into play. I always say to use whichever feels comfortable for you that works.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
InfoHound
post Nov 20 2019, 06:53 PM
Post#5



Posts: 1,175
Joined: 1-December 12



Thanks again theDBguy!

I'm on to DLOOKUp an will be making changes to my program accordingly.

You're correct the situation is a very big factor.
Go to the top of the page
 
theDBguy
post Nov 20 2019, 07:41 PM
Post#6


UA Moderator
Posts: 76,826
Joined: 19-June 07
From: SunnySandyEggo


Hi. Good luck. Later on, if you find a "better" way, you can change it again. Cheers!

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    9th December 2019 - 11:24 AM