A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Problem with Expression



 
 
Thread Tools Display Modes
  #1  
Old November 9th, 2009, 09:35 PM posted to microsoft.public.access.forms
Rene
external usenet poster
 
Posts: 140
Default Problem with Expression

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
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:12 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.