J
Josiah
Elements and Structure: I have a Crosstab query which selects data
from a set of tables that hold all of the financial information for a
particular program within a company. This query is arranged such that
there are 5 rowwise fields which list an empoyee's name, department,
charge code, etc. Then, the columnwise field is based on the labor
charge date charged hours are associated with. The way the columnwise
field works is it operates on two parameters that are dates,which are
gathered from 2 combo boxes in a form. These 2 parameters are used to
determine the date range to pull labor charging information from. For
example, if combobox1 = 01/01/2007 and combobox2 = 02/01/2007, then
there will be a column heading for every date in between those 2 dates
for which there was labor charged. The smallest interval is 1 week,
so querying on a full month would never return more than 5 values
(because there cannot be more than 5 weeks in a month). The value
field, then, is the actual hours charged by a certain person on a
certain date under a certain charge number.
Goal: What I want to do is create a report based on this query. I
only need to display 6-7 weeks of data, so I will not need to include
more than 7 date fields in the report. If a date range of greater
than 7 weeks is selected, it is acceptable for me to just drop all
data falling after the 7 week period.
Problem: every textbox will have to be bound dynamically, and the date
field labels will have to be set dynamically at runtime in order to
get the desired report. I would like to be able to group information
on the first 3 rowwise fields of the crosstab query.
Where I am: since it is acceptable for me to just drop all data
falling after the 7 week period, in my code I only iterate on the
first 11 fields of my crosstab query. That way, any information
falling later than the acceptable timeframe is dropped without needing
to crash the system. I have all of the labels successfully displaying
the correct field names in the form. However, when it comes to actual
data in the textboxes, it seems the binding is not being done right,
because I get the message #Name? in each textbox. The way I tried to
accomplish binding was to go into the VBA code of the report, store a
QueryDef of my crosstab query, providing values for the parameters
based upon my form with the two date combo boxes. I then opened a
recordset of that query and stored it in a variable, lets call it,
rcdSet. So, to update the labels, I named the labels L00 - L11 and
then cycled through the fields in rcdSet, setting the caption of each
label to rcdSet.Fields(IterationNumber).Name. This works fine. But
when I tried the same thing witht he text boxes, naming the textboxes
M00-M11 and ctrl(M[IterationNumber]).ControlSource = rcdSet.Fields
(IterationNumber).Name All that turns up in my text boxes is #Name?.
Can someone help me out?
If you need sample code, let me know and I will cook something up.
from a set of tables that hold all of the financial information for a
particular program within a company. This query is arranged such that
there are 5 rowwise fields which list an empoyee's name, department,
charge code, etc. Then, the columnwise field is based on the labor
charge date charged hours are associated with. The way the columnwise
field works is it operates on two parameters that are dates,which are
gathered from 2 combo boxes in a form. These 2 parameters are used to
determine the date range to pull labor charging information from. For
example, if combobox1 = 01/01/2007 and combobox2 = 02/01/2007, then
there will be a column heading for every date in between those 2 dates
for which there was labor charged. The smallest interval is 1 week,
so querying on a full month would never return more than 5 values
(because there cannot be more than 5 weeks in a month). The value
field, then, is the actual hours charged by a certain person on a
certain date under a certain charge number.
Goal: What I want to do is create a report based on this query. I
only need to display 6-7 weeks of data, so I will not need to include
more than 7 date fields in the report. If a date range of greater
than 7 weeks is selected, it is acceptable for me to just drop all
data falling after the 7 week period.
Problem: every textbox will have to be bound dynamically, and the date
field labels will have to be set dynamically at runtime in order to
get the desired report. I would like to be able to group information
on the first 3 rowwise fields of the crosstab query.
Where I am: since it is acceptable for me to just drop all data
falling after the 7 week period, in my code I only iterate on the
first 11 fields of my crosstab query. That way, any information
falling later than the acceptable timeframe is dropped without needing
to crash the system. I have all of the labels successfully displaying
the correct field names in the form. However, when it comes to actual
data in the textboxes, it seems the binding is not being done right,
because I get the message #Name? in each textbox. The way I tried to
accomplish binding was to go into the VBA code of the report, store a
QueryDef of my crosstab query, providing values for the parameters
based upon my form with the two date combo boxes. I then opened a
recordset of that query and stored it in a variable, lets call it,
rcdSet. So, to update the labels, I named the labels L00 - L11 and
then cycled through the fields in rcdSet, setting the caption of each
label to rcdSet.Fields(IterationNumber).Name. This works fine. But
when I tried the same thing witht he text boxes, naming the textboxes
M00-M11 and ctrl(M[IterationNumber]).ControlSource = rcdSet.Fields
(IterationNumber).Name All that turns up in my text boxes is #Name?.
Can someone help me out?
If you need sample code, let me know and I will cook something up.