Two Case Statements on one line

  • Thread starter Afrosheen via AccessMonster.com
  • Start date
A

Afrosheen via AccessMonster.com

Thanks for your time.

I have two case statements where both are equal to the same. The Work Plans
and the Late Work Plans are the same. I've tried using this but it didn't
work: Case "Work Plans" or "Late Work Plans". I also tried: Case "Work
Plans", "Late Work Plans" and that didn't work. I know that there must be a
way of doing this.

Select Case flg
Case "Work Plans"
If head1 = "True" Then
Me.txtRep.ControlSource = "=[lname] & "", "" & [fname] & "" -- "" &
[WorkPlan] & "" -- "" & [Location]"
Else
Me.txtRep.ControlSource = "=[lname] & "", "" & [fname] & "" ---- "" &
[WorkPlan]"
End If

Case "Late Work Plans"
If head1 = "True" Then
Me.txtRep.ControlSource = "=[lname] & "", "" & [fname] & "" -- "" &
[WorkPlan] & "" -- "" & [Location]"
Else
Me.txtRep.ControlSource = "=[lname] & "", "" & [fname] & "" ---- "" &
[WorkPlan]"
End If
end select

Thanks for your help and reply.
 
J

JimBurke via AccessMonster.com

You can specify as many individual Cases on a line as you need to , each
separated by a comma. If that didn't work you must have had something wrong
in your code. There's no reason that

Case "Work Plans", "Late Work Plans"

shouldn't work. You may want to code that again and set a break point to see
what the value of flg is when you think it should match. I use this type of
case statement throughout my app, so I know it works.
Thanks for your time.

I have two case statements where both are equal to the same. The Work Plans
and the Late Work Plans are the same. I've tried using this but it didn't
work: Case "Work Plans" or "Late Work Plans". I also tried: Case "Work
Plans", "Late Work Plans" and that didn't work. I know that there must be a
way of doing this.

Select Case flg
Case "Work Plans"
If head1 = "True" Then
Me.txtRep.ControlSource = "=[lname] & "", "" & [fname] & "" -- ""
[WorkPlan] & "" -- "" & [Location]"
Else
Me.txtRep.ControlSource = "=[lname] & "", "" & [fname] & "" ---- "" &
[WorkPlan]"
End If

Case "Late Work Plans"
If head1 = "True" Then
Me.txtRep.ControlSource = "=[lname] & "", "" & [fname] & "" -- "" &
[WorkPlan] & "" -- "" & [Location]"
Else
Me.txtRep.ControlSource = "=[lname] & "", "" & [fname] & "" ---- "" &
[WorkPlan]"
End If
end select

Thanks for your help and reply.
 
A

Afrosheen via AccessMonster.com

Thanks Jim. It must be I was missing something. It's working now. I really
appreciate your help.

You can specify as many individual Cases on a line as you need to , each
separated by a comma. If that didn't work you must have had something wrong
in your code. There's no reason that

Case "Work Plans", "Late Work Plans"

shouldn't work. You may want to code that again and set a break point to see
what the value of flg is when you think it should match. I use this type of
case statement throughout my app, so I know it works.
Thanks for your time.
[quoted text clipped - 25 lines]
Thanks for your help and reply.
 

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