Reputation: 1139
I am building a form which needs to extract values from the table 'tblContacts' shown in the two queries i built below. I don't understand why when building my control text boxes on my form, why the first query works fine, but the second query does not allow me to extract specific values from the contacts table. For example, using the second query, I was not able to get the correct value in the field tblContacts.Level. However, when i built the specified query (the second example) all works fine. My first instinct tells me that there is something in the properties on the form which I need to change, but until now, I am having no luck.
Example 1 (which does not work)
sql_get = " SELECT * FROM [tblContacts] INNER JOIN [tblteams] ON [tblcontacts].[Team] = [tblteams].[ID] WHERE [tblTeams].[team]= '" & cboDepartments.Value & "'"
Me.frmstaticdatadepartments08.Form.RecordSource = sql_get
Example 2 (works fine)
sql_get = "SELECT tblContacts.CompleteName, tblContacts.CurrentPosition, tblContacts.Level, tblContacts.ContractType, tblContacts.JobTitle, tblContacts.ID, tblContacts.Foto FROM tblContacts INNER JOIN tblTeams ON tblContacts.Team = tblTeams.ID WHERE [tblTeams].[team]= '" & cboDepartments.Value & "'"
Me.frmstaticdatadepartments08.Form.RecordSource = sql_get
Upvotes: 0
Views: 71
Reputation: 2886
this solve the problem :
sql_get = "SELECT tblContacts.*, tblContacts.CurrentPosition, tblContacts.Level, tblContacts.ContractType, tblContacts.JobTitle, tblContacts.ID, tblContacts.Foto FROM tblContacts INNER JOIN tblTeams ON tblContacts.Team = tblTeams.ID WHERE [tblTeams].[team]= '" & cboDepartments.Value & "'"
PS : thnks for your courtesy guys :)
Upvotes: 2