C
Chrisx
Hi,
I have written code to modify a query based on a table
that the user creates from excel. This query is used in a
report. The table only contains 1 column, but in case the
user creates the table with a different column name, I
want to make sure that the query and report use the
correct names.
The user keys the table name into a form. The form
runs the code to modify the query, and eventually, run the
report.
I included the code that I have to match the query to
the table that the user enters into my form, but not sure
how to change the control in the report to match the
column in the query.
Can anybody help me with this next part?
Dim qdf As QueryDef
Dim sqlSTR As String
Set qdf = CurrentDb.QueryDefs("User_Qry")
sqlSTR = "Select * from [" & Forms![XREF_Form]!UserTbl
& "]"
qdf.SQL = sqlSTR
qdf.Close
I have written code to modify a query based on a table
that the user creates from excel. This query is used in a
report. The table only contains 1 column, but in case the
user creates the table with a different column name, I
want to make sure that the query and report use the
correct names.
The user keys the table name into a form. The form
runs the code to modify the query, and eventually, run the
report.
I included the code that I have to match the query to
the table that the user enters into my form, but not sure
how to change the control in the report to match the
column in the query.
Can anybody help me with this next part?
Dim qdf As QueryDef
Dim sqlSTR As String
Set qdf = CurrentDb.QueryDefs("User_Qry")
sqlSTR = "Select * from [" & Forms![XREF_Form]!UserTbl
& "]"
qdf.SQL = sqlSTR
qdf.Close