R
Rene
Good afternoon,
I have a parent form with 2 list boxes and 2 text boxes that supply
information to an expression located within a calculated control in a
subform.
ListBox 1 name is: [FilterCompany]
ListBox 2 name is: [FilterDivision]
TextBox 1 name is: [FilterBeginDate]
TextBox 2 name is: [FilterEndDate]
Because both Company and Division have their own table, in order to factor
these two into the count, I pull the information from a query where the two
tables are joined to an Injury Illness table.
The expression located with the calculated control in the subform is:
=Format(DCount("[InjuryIllnessCaseNumber]","qryInjuryIllnessCases","[InjuryIllnessCaseDate]<=[Forms]![frmIncidentsDataRetrievalScreen]![FilterEndDate]
And
[InjuryIllnessCaseDate]>=[Forms]![frmIncidentsDataRetrievalScreen]![FilterBeginDate]
And ([InjuryIllnessCaseClassificationID]=2 or 8 or 5) And
([EstablishmentCompanyID]=[Forms]![frmIncidentsDataRetrievalScreen]![FilterCompany])
And
([EstablishmentDivisionID]=[Forms]![frmIncidentsDataRetrievalScreen]![FilterDivision]) "),"#,##0")
The expression works fine, but I have to select an option from each list
box, otherwise it will not count the records. What I would like to do is:
1) If I do not select an option from any list box, I want the expression to
disregard the list boxes and return a count based only on the date range. In
other words, the expression will include all records.
2) Be able to select multiple options from the list box and have those
factored into the expression. The current expression only allows me to select
one option and factor in only that one option.
Formats:
ListBox format is Number. Company A is 1, Company B is 2, etc.
Division A is 1, Division B is 2, etc.
TextBox is Date.
Thanks in advance for your help,
Rene
I have a parent form with 2 list boxes and 2 text boxes that supply
information to an expression located within a calculated control in a
subform.
ListBox 1 name is: [FilterCompany]
ListBox 2 name is: [FilterDivision]
TextBox 1 name is: [FilterBeginDate]
TextBox 2 name is: [FilterEndDate]
Because both Company and Division have their own table, in order to factor
these two into the count, I pull the information from a query where the two
tables are joined to an Injury Illness table.
The expression located with the calculated control in the subform is:
=Format(DCount("[InjuryIllnessCaseNumber]","qryInjuryIllnessCases","[InjuryIllnessCaseDate]<=[Forms]![frmIncidentsDataRetrievalScreen]![FilterEndDate]
And
[InjuryIllnessCaseDate]>=[Forms]![frmIncidentsDataRetrievalScreen]![FilterBeginDate]
And ([InjuryIllnessCaseClassificationID]=2 or 8 or 5) And
([EstablishmentCompanyID]=[Forms]![frmIncidentsDataRetrievalScreen]![FilterCompany])
And
([EstablishmentDivisionID]=[Forms]![frmIncidentsDataRetrievalScreen]![FilterDivision]) "),"#,##0")
The expression works fine, but I have to select an option from each list
box, otherwise it will not count the records. What I would like to do is:
1) If I do not select an option from any list box, I want the expression to
disregard the list boxes and return a count based only on the date range. In
other words, the expression will include all records.
2) Be able to select multiple options from the list box and have those
factored into the expression. The current expression only allows me to select
one option and factor in only that one option.
Formats:
ListBox format is Number. Company A is 1, Company B is 2, etc.
Division A is 1, Division B is 2, etc.
TextBox is Date.
Thanks in advance for your help,
Rene