I am trying to source a value in a form from the table in the code below 'tblJobTitles'. The value I would like to source is the value 'JobTitle' Unfortunately, in the control box i keep getting #Name? error. I am trying to adust the properties but everthing i try gives me the same error.
Note: if i attempt to do this without joining 'tblContacts' to 'tblJobTitles' and using only 'tblContacts', I can successfully retrieve the job title in the field on the form, only that it returns the numerical unique ID number from the job title table. Is it possible to reformat it to return the text value?
sql_get = "SELECT tblContacts.*, tblJobTitles.* FROM tblJobTitles INNER JOIN (tblContacts INNER JOIN tblTeams ON tblContacts.Team = tblTeams.ID) ON tblJobTitles.ID = tblContacts.JobTitle WHERE [tblTeams].[team]= '" & cboDepartments.Value & "'"
Me.frmstaticdatadepartments08.Form.RecordSource = sql_get
sql_get, writeDebug.Print sql_get. Put a breakpoint on that line. Let us know what it prints outsql_getand for form record source assignmenttblContacts.JobTitle AS ContactsJobTitle, tblJobTitle.JobTitle AS [Job_Title]or something. The fact that there's 2 similar fields and you're simply selecting all (*), it's confusing Access.