I am trying to create a query using the following code.
Them problem is the joined field on one query is a 4 column combobox that is bound to column 1. Can't seem to make it work. Anywhere you see DPM1 in my code below is actually trying to pull the information of DPM1.Column(1)
Can this be done and if so, what would the code be,
Here is my code.
Dim sSQL As String 'query string
sSQL = "SELECT [Target_Projects Query].[Target_Projects_Project #],"
sSQL = sSQL & " [Target_Projects Query].Location,"
sSQL = sSQL & " [Target_Projects Query].DPM1,"
sSQL = sSQL & " [Target_Projects Query].Target_Projects.t_num,"
sSQL = sSQL & " [Contacts Extended].[Contact Name],"
sSQL = sSQL & " [Contacts Extended].Company,"
sSQL = sSQL & " [Contacts Extended].Address,"
sSQL = sSQL & " [Contacts Extended].City,"
sSQL = sSQL & " [Contacts Extended].[State/Province],"
sSQL = sSQL & " [Contacts Extended].[ZIP/Postal Code]"
sSQL = sSQL + " FROM [Target_Projects Query]"
sSQL = sSQL + " LEFT JOIN [Contacts Extended]"
sSQL = sSQL & " ON [Target_Projects Query].DPM1 = [Contacts Extended].[Contact Name]"
sSQL = sSQL & " WHERE ((([Target_Projects Query].Target_Projects.t_num)='" & rcd & "'));"
Set qdf = CurrentDb.CreateQueryDef("Trans", sSQL)
Them problem is the joined field on one query is a 4 column combobox that is bound to column 1. Can't seem to make it work. Anywhere you see DPM1 in my code below is actually trying to pull the information of DPM1.Column(1)
Can this be done and if so, what would the code be,
Here is my code.
Dim sSQL As String 'query string
sSQL = "SELECT [Target_Projects Query].[Target_Projects_Project #],"
sSQL = sSQL & " [Target_Projects Query].Location,"
sSQL = sSQL & " [Target_Projects Query].DPM1,"
sSQL = sSQL & " [Target_Projects Query].Target_Projects.t_num,"
sSQL = sSQL & " [Contacts Extended].[Contact Name],"
sSQL = sSQL & " [Contacts Extended].Company,"
sSQL = sSQL & " [Contacts Extended].Address,"
sSQL = sSQL & " [Contacts Extended].City,"
sSQL = sSQL & " [Contacts Extended].[State/Province],"
sSQL = sSQL & " [Contacts Extended].[ZIP/Postal Code]"
sSQL = sSQL + " FROM [Target_Projects Query]"
sSQL = sSQL + " LEFT JOIN [Contacts Extended]"
sSQL = sSQL & " ON [Target_Projects Query].DPM1 = [Contacts Extended].[Contact Name]"
sSQL = sSQL & " WHERE ((([Target_Projects Query].Target_Projects.t_num)='" & rcd & "'));"
Set qdf = CurrentDb.CreateQueryDef("Trans", sSQL)