Full Version: displaying subform data on a form
UtterAccess Forums > Microsoft® Access > Access Forms
drxman
I have a form, subform
frmMaster
sfrmEmploymentDetail
And a table (tblJobTitles)
I want to be able to display a persons Job Title on frmMaster
The control in the sfrm shows the "JobTitlesFK" and that is related to JobTitlesPK in "tblJobTitles"
= [tblJobTitles]![JobTitle] WHERE ([tblJobTitles]![JobTitlesPK] = [sfrmEmploymentDetails].[Form]![JobTitlesFK])
However, when I use the above statement I'm told that it is an invalid syntax.
Am I allowed to use "WHERE" in the control source of of a control on a form?
I'm able to set it up to show the "JobTitlesFK" (just used [sfrmEmploymentDetails].[Form]![JobTitlesFK]) but I want to show what the "JobTitlesFK" is related to in the tblJobTitles.
dashiellx2000
I think you want to use a DLookup Function for this.
TH
drxman
Yep, thanks! Worked out great. :-)
DLookUp("[tblJobTitles]![JobTitle]","tblJobTitles"," [sfrmEmploymentDetails].[Form]![JobTitlesFK] = [tblJobTitles]![JobTitlesPK]")
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.