D
Dave
Tried all day to fix this. I want to output some of a continuous
form's fields as an Excel file in an email. A filter is applied to
this form (as a string variable) when it opens, so I moved that
variable into a module which contains the ' getDeptList ' function and
made the variable global:
Global strDept As String.
The function is:
Public Function getDeptList() As String
getDeptList = strDept
End Function
The Dept field criteria in the query design is 'getDeptList()'. I
click on a button and invoke the query with:
DoCmd.SendObject acSendQuery, "qryTaskPartsDetail", acFormatXLS.
If I step through the code, the function is called (I assume by the
query). Just before the email opens, I can see the value of getDeptList
() in the immediate window is exactly what I expect:
?getDeptList
'1CCM'
When I open the attachment in the email, there are no records in it.
I've tried everything I can think of to fix this, to no avail. If I
substitute the literal '1CCM' in the query grid, I get records if I
run it. The WHERE part of the sql is:
WHERE (((tblRawData.DEPT_CD) In (getDeptList())) AND...
While I would like to know what's wrong, I have decided I can't use
this if I cannot use the In operator/function in the sql, as: In
(getDeptList())
Why is this query ignoring the function's returned value?
Is there a better way to send part of a continuous form output where a
record filter has been employed? I confess I don't know much about
creating recordsets and have thought about that. Thanks in advance.
form's fields as an Excel file in an email. A filter is applied to
this form (as a string variable) when it opens, so I moved that
variable into a module which contains the ' getDeptList ' function and
made the variable global:
Global strDept As String.
The function is:
Public Function getDeptList() As String
getDeptList = strDept
End Function
The Dept field criteria in the query design is 'getDeptList()'. I
click on a button and invoke the query with:
DoCmd.SendObject acSendQuery, "qryTaskPartsDetail", acFormatXLS.
If I step through the code, the function is called (I assume by the
query). Just before the email opens, I can see the value of getDeptList
() in the immediate window is exactly what I expect:
?getDeptList
'1CCM'
When I open the attachment in the email, there are no records in it.
I've tried everything I can think of to fix this, to no avail. If I
substitute the literal '1CCM' in the query grid, I get records if I
run it. The WHERE part of the sql is:
WHERE (((tblRawData.DEPT_CD) In (getDeptList())) AND...
While I would like to know what's wrong, I have decided I can't use
this if I cannot use the In operator/function in the sql, as: In
(getDeptList())
Why is this query ignoring the function's returned value?
Is there a better way to send part of a continuous form output where a
record filter has been employed? I confess I don't know much about
creating recordsets and have thought about that. Thanks in advance.