Select Case help

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,
 
G

Gary Miller

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)
 
D

Douglas J. Steele

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top