M
Mike P
I have a query that accepts a parameter to run. The queary with the
parameter, CustomerNumber, runs fine when I do one at a time and the Enter
Parameter window pops up. However, I wish to pass the parameter to the query
programaticlly and not have the Enter Parameter window pop up. This will
allow me to pull the parameters from a tmp table and produce outputted xls
without requiring human intervention.
I realize I can take the SQL logic and write it in the code, but the SQL is
large and complex. It would be much easier to just feed the parameter into
the query programaticlly. Is this possible? I have read a bunch, but can’t
find the anser.
Dim strCustomerNumber As String, _
strQuery As String,
strFile As String
Do while moreCustomerNumbersExists
strCustomerNumber = “test123†‘ this will be put in a loop and pulled
from a tmp table
strFile = CustomerNumber & “.xlsâ€
‘How do I call my query by sending in the paramenter strCustomerNumber so
that the Enter Parameter window does not pop up???
' something like - qryGetCustomerData, Parameter=strCustomerNumber" ? ? ? ?
DoCmd.OutputTo acOutputQuery, "qryGetCustomerData", acFormatXLS,
strFile, True
Loop
parameter, CustomerNumber, runs fine when I do one at a time and the Enter
Parameter window pops up. However, I wish to pass the parameter to the query
programaticlly and not have the Enter Parameter window pop up. This will
allow me to pull the parameters from a tmp table and produce outputted xls
without requiring human intervention.
I realize I can take the SQL logic and write it in the code, but the SQL is
large and complex. It would be much easier to just feed the parameter into
the query programaticlly. Is this possible? I have read a bunch, but can’t
find the anser.
Dim strCustomerNumber As String, _
strQuery As String,
strFile As String
Do while moreCustomerNumbersExists
strCustomerNumber = “test123†‘ this will be put in a loop and pulled
from a tmp table
strFile = CustomerNumber & “.xlsâ€
‘How do I call my query by sending in the paramenter strCustomerNumber so
that the Enter Parameter window does not pop up???
' something like - qryGetCustomerData, Parameter=strCustomerNumber" ? ? ? ?
DoCmd.OutputTo acOutputQuery, "qryGetCustomerData", acFormatXLS,
strFile, True
Loop