Select Case help

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi there, I have the following series of if statements. I want to find a
more efficient way to run this. If a select case is the way to go, how do i
set it up. I have to continue this series of if's for each month of the year:

=IIf(Forms!frmBilling!txtBillingMonth="January",[JanBWCount]) &
IIf(Forms!frmBilling!txtBillingMonth="February",[FebBWCount]) & iif(etc for
March through December....

Many thanks in advance,
 
Select Case Forms!frmBilling!txtBillingMonth
Case "January"
Do something
?? Something = Forms!frmBilling!JanBWCount ??
Case "February"
Do something
Case etc...
End Select

If you are calling this from the form you can lose
"Forms!frmBilling" and just use Me (Me!txtBillingMonth)
 
It would probably be much easier if your tables were normalized. Having
field names lik JanBWCount, FebBWCount etc are indicative of having
Repeating Groups, which means your database isn't even in First Normal Form.
Rather than having twelve fields in a single row, you should have twelve
rows in a second table, with each row having the month as part of its PK.

Take a look at some of the database design resource Jeff Conrad has at
http://home.bendbroadband.com/conradsystems/accessjunkie/resources.html#DatabaseDesign101
 
Back
Top