Switch Issues

B

Byron

I would suggest that you might want to consider writing
your own function that would evaluate all of the options
and return the appropriate value instead of trying to use
the Switch function. It sounds like you have multiple
evaluations that need to happen. You might try using a
Case statement in your function.

HTH

Byron
-----Original Message-----
I have the following as a text box control source which
is close to working properly but not quite and I need
some help.
=Switch([Waive Service Call],"Waived",[Cancel Service
Call],"Canceled",[Rescheduled Service
Month],"Rescheduled",[Date Written Report Sent] Is Not
Null,"Completed",Not IsNull([Date Written Report
Sent]),"Completed",True,"Pending")
I have a database where all items are
considered "Pending" until some entry on a form is
completed. A person can check a box "Waive", they can
check a box "Cancel" or they can enter a date for a
field "Rescheduled". If a field "Date Written Report
Sent is filled out, then it is considered "Completed".
The person can either check "Cancel" or Waive" and that
might end the item. Entering a date in "Rescheduled"
field leaves it open still for all possibilities.
Filling out the date field "Date Written Report Sent"
ends the item as well.
I noticed issues where if a person filled the
Rescheduled Date out the report correctly shows
rescheduled but if they later filled out the Date Written
Report Sent the field still shows Rescheduled and not
Completed as it should.
I also noticed that if you waive or cancel and then for
some reason filled out Date Written Report Sent later
than it wil still say Waived or Canceled.
How do I improve the switch to account for those
possibilities? Do I need multiple if statements?
If I clear the first choice out of the form the other
choices then work but we need to be able to show the
trail in the report so multiple choices need to be
accounted for. I just need to write the correct
arguments.
 
B

bdehning

Can you help get me started on the function with case?
--
Brian


Byron said:
I would suggest that you might want to consider writing
your own function that would evaluate all of the options
and return the appropriate value instead of trying to use
the Switch function. It sounds like you have multiple
evaluations that need to happen. You might try using a
Case statement in your function.

HTH

Byron
-----Original Message-----
I have the following as a text box control source which
is close to working properly but not quite and I need
some help.
=Switch([Waive Service Call],"Waived",[Cancel Service
Call],"Canceled",[Rescheduled Service
Month],"Rescheduled",[Date Written Report Sent] Is Not
Null,"Completed",Not IsNull([Date Written Report
Sent]),"Completed",True,"Pending")
I have a database where all items are
considered "Pending" until some entry on a form is
completed. A person can check a box "Waive", they can
check a box "Cancel" or they can enter a date for a
field "Rescheduled". If a field "Date Written Report
Sent is filled out, then it is considered "Completed".
The person can either check "Cancel" or Waive" and that
might end the item. Entering a date in "Rescheduled"
field leaves it open still for all possibilities.
Filling out the date field "Date Written Report Sent"
ends the item as well.
I noticed issues where if a person filled the
Rescheduled Date out the report correctly shows
rescheduled but if they later filled out the Date Written
Report Sent the field still shows Rescheduled and not
Completed as it should.
I also noticed that if you waive or cancel and then for
some reason filled out Date Written Report Sent later
than it wil still say Waived or Canceled.
How do I improve the switch to account for those
possibilities? Do I need multiple if statements?
If I clear the first choice out of the form the other
choices then work but we need to be able to show the
trail in the report so multiple choices need to be
accounted for. I just need to write the correct
arguments.
 
B

Byron

Brian,

I would need a little more information before attempting
to write the function.

Is there some kind of work flow to the fields you are
going to use to establisk the status?

Have you tried using the AfterUpdate event of each of the
various fields (controls) to set the value of your text
box control?

For example, when the user checks the "Waive" check box,
the code could set the value of your text box:

If me.NameOfWaiveChkBox = true then
me.YourTextBox = "Waived"
'here you could even disable other controls
'if desired.
End If

If you take this approach, you would need code like this
on each of your controls that will change the value of
your text box.

HTH

Byron
-----Original Message-----
Can you help get me started on the function with case?
--
Brian


Byron said:
I would suggest that you might want to consider writing
your own function that would evaluate all of the options
and return the appropriate value instead of trying to use
the Switch function. It sounds like you have multiple
evaluations that need to happen. You might try using a
Case statement in your function.

HTH

Byron
-----Original Message-----
I have the following as a text box control source
which
is close to working properly but not quite and I need
some help.
=Switch([Waive Service Call],"Waived",[Cancel Service
Call],"Canceled",[Rescheduled Service
Month],"Rescheduled",[Date Written Report Sent] Is Not
Null,"Completed",Not IsNull([Date Written Report
Sent]),"Completed",True,"Pending")
I have a database where all items are
considered "Pending" until some entry on a form is
completed. A person can check a box "Waive", they can
check a box "Cancel" or they can enter a date for a
field "Rescheduled". If a field "Date Written Report
Sent is filled out, then it is considered "Completed".
The person can either check "Cancel" or Waive" and that
might end the item. Entering a date in "Rescheduled"
field leaves it open still for all possibilities.
Filling out the date field "Date Written Report Sent"
ends the item as well.
I noticed issues where if a person filled the
Rescheduled Date out the report correctly shows
rescheduled but if they later filled out the Date Written
Report Sent the field still shows Rescheduled and not
Completed as it should.
I also noticed that if you waive or cancel and then
for
some reason filled out Date Written Report Sent later
than it wil still say Waived or Canceled.
How do I improve the switch to account for those
possibilities? Do I need multiple if statements?
If I clear the first choice out of the form the other
choices then work but we need to be able to show the
trail in the report so multiple choices need to be
accounted for. I just need to write the correct
arguments..
 
B

bdehning

It starts with all calls set up in our system considered "Pending". Then a call can be completed by entering a date on a form in Date Correspondence Sent. This would "Complete" the call.

Instead of completing the call we can check a box to either "Cancel" or "Waive" a call" we need to make by a certain date. This should be the end status for this call at this point.

The call could also be "Rescheduled" to another date and then later may be "canceled", "waived" or "completed". This should then end the call status

The switch is used in the text box where I want the words either: "Pending", "Completed", "Waived", "Canceled" or "Rescheduled" to appear depending on what the status from above determines.

My switch takes care of some of the alternatives but not all as I mentioned. It does not take into account some times one choice is made but then later a different choice is selected.

Does this info help?

--
Brian


Byron said:
Brian,

I would need a little more information before attempting
to write the function.

Is there some kind of work flow to the fields you are
going to use to establisk the status?

Have you tried using the AfterUpdate event of each of the
various fields (controls) to set the value of your text
box control?

For example, when the user checks the "Waive" check box,
the code could set the value of your text box:

If me.NameOfWaiveChkBox = true then
me.YourTextBox = "Waived"
'here you could even disable other controls
'if desired.
End If

If you take this approach, you would need code like this
on each of your controls that will change the value of
your text box.

HTH

Byron
-----Original Message-----
Can you help get me started on the function with case?
--
Brian


Byron said:
I would suggest that you might want to consider writing
your own function that would evaluate all of the options
and return the appropriate value instead of trying to use
the Switch function. It sounds like you have multiple
evaluations that need to happen. You might try using a
Case statement in your function.

HTH

Byron

-----Original Message-----
I have the following as a text box control source which
is close to working properly but not quite and I need
some help.

=Switch([Waive Service Call],"Waived",[Cancel Service
Call],"Canceled",[Rescheduled Service
Month],"Rescheduled",[Date Written Report Sent] Is Not
Null,"Completed",Not IsNull([Date Written Report
Sent]),"Completed",True,"Pending")

I have a database where all items are
considered "Pending" until some entry on a form is
completed. A person can check a box "Waive", they can
check a box "Cancel" or they can enter a date for a
field "Rescheduled". If a field "Date Written Report
Sent is filled out, then it is considered "Completed".
The person can either check "Cancel" or Waive" and that
might end the item. Entering a date in "Rescheduled"
field leaves it open still for all possibilities.
Filling out the date field "Date Written Report Sent"
ends the item as well.

I noticed issues where if a person filled the
Rescheduled Date out the report correctly shows
rescheduled but if they later filled out the Date Written
Report Sent the field still shows Rescheduled and not
Completed as it should.

I also noticed that if you waive or cancel and then for
some reason filled out Date Written Report Sent later
than it wil still say Waived or Canceled.

How do I improve the switch to account for those
possibilities? Do I need multiple if statements?

If I clear the first choice out of the form the other
choices then work but we need to be able to show the
trail in the report so multiple choices need to be
accounted for. I just need to write the correct
arguments.
.
 
B

Byron

Brian,

I think that I would still take the approach that I
described in my previous reply. I do not think that you
can expect to get the results you are looking for using
the Switch function. I think that you are going to have
to have some code behind each of the options that the user
can use. You would then also be able to control which
options are available to the user after certain options
have been utilized. I sounds to me that you need to be
evaluating the situation after any entry by the user not
just evaluating a condition.

Byron
-----Original Message-----
It starts with all calls set up in our system
considered "Pending". Then a call can be completed by
entering a date on a form in Date Correspondence Sent.
This would "Complete" the call.
Instead of completing the call we can check a box to
either "Cancel" or "Waive" a call" we need to make by a
certain date. This should be the end status for this call
at this point.
The call could also be "Rescheduled" to another date and
then later may be "canceled", "waived" or "completed".
This should then end the call status
The switch is used in the text box where I want the words
either: "Pending", "Completed", "Waived", "Canceled"
or "Rescheduled" to appear depending on what the status
from above determines.
My switch takes care of some of the alternatives but not
all as I mentioned. It does not take into account some
times one choice is made but then later a different choice
is selected.
Does this info help?

--
Brian


Byron said:
Brian,

I would need a little more information before attempting
to write the function.

Is there some kind of work flow to the fields you are
going to use to establisk the status?

Have you tried using the AfterUpdate event of each of the
various fields (controls) to set the value of your text
box control?

For example, when the user checks the "Waive" check box,
the code could set the value of your text box:

If me.NameOfWaiveChkBox = true then
me.YourTextBox = "Waived"
'here you could even disable other controls
'if desired.
End If

If you take this approach, you would need code like this
on each of your controls that will change the value of
your text box.

HTH

Byron
-----Original Message-----
Can you help get me started on the function with case?
--
Brian


:

I would suggest that you might want to consider writing
your own function that would evaluate all of the options
and return the appropriate value instead of trying
to
use
the Switch function. It sounds like you have multiple
evaluations that need to happen. You might try using a
Case statement in your function.

HTH

Byron

-----Original Message-----
I have the following as a text box control source which
is close to working properly but not quite and I need
some help.

=Switch([Waive Service Call],"Waived",[Cancel Service
Call],"Canceled",[Rescheduled Service
Month],"Rescheduled",[Date Written Report Sent] Is Not
Null,"Completed",Not IsNull([Date Written Report
Sent]),"Completed",True,"Pending")

I have a database where all items are
considered "Pending" until some entry on a form is
completed. A person can check a box "Waive", they can
check a box "Cancel" or they can enter a date for a
field "Rescheduled". If a field "Date Written Report
Sent is filled out, then it is considered "Completed".
The person can either check "Cancel" or Waive" and that
might end the item. Entering a date in "Rescheduled"
field leaves it open still for all possibilities.
Filling out the date field "Date Written Report Sent"
ends the item as well.

I noticed issues where if a person filled the
Rescheduled Date out the report correctly shows
rescheduled but if they later filled out the Date Written
Report Sent the field still shows Rescheduled and not
Completed as it should.

I also noticed that if you waive or cancel and then for
some reason filled out Date Written Report Sent later
than it wil still say Waived or Canceled.

How do I improve the switch to account for those
possibilities? Do I need multiple if statements?

If I clear the first choice out of the form the other
choices then work but we need to be able to show the
trail in the report so multiple choices need to be
accounted for. I just need to write the correct
arguments.

--
Brian
.


.
.
 
B

bdehning

Byron, actually by changing the order of the items in the switch I was able to get it to work properly.

By the way, your option regarding code for every option, where would it be placed and what might an example be for future reference?
--
Brian


Byron said:
Brian,

I think that I would still take the approach that I
described in my previous reply. I do not think that you
can expect to get the results you are looking for using
the Switch function. I think that you are going to have
to have some code behind each of the options that the user
can use. You would then also be able to control which
options are available to the user after certain options
have been utilized. I sounds to me that you need to be
evaluating the situation after any entry by the user not
just evaluating a condition.

Byron
-----Original Message-----
It starts with all calls set up in our system
considered "Pending". Then a call can be completed by
entering a date on a form in Date Correspondence Sent.
This would "Complete" the call.
Instead of completing the call we can check a box to
either "Cancel" or "Waive" a call" we need to make by a
certain date. This should be the end status for this call
at this point.
The call could also be "Rescheduled" to another date and
then later may be "canceled", "waived" or "completed".
This should then end the call status
The switch is used in the text box where I want the words
either: "Pending", "Completed", "Waived", "Canceled"
or "Rescheduled" to appear depending on what the status
from above determines.
My switch takes care of some of the alternatives but not
all as I mentioned. It does not take into account some
times one choice is made but then later a different choice
is selected.
Does this info help?

--
Brian


Byron said:
Brian,

I would need a little more information before attempting
to write the function.

Is there some kind of work flow to the fields you are
going to use to establisk the status?

Have you tried using the AfterUpdate event of each of the
various fields (controls) to set the value of your text
box control?

For example, when the user checks the "Waive" check box,
the code could set the value of your text box:

If me.NameOfWaiveChkBox = true then
me.YourTextBox = "Waived"
'here you could even disable other controls
'if desired.
End If

If you take this approach, you would need code like this
on each of your controls that will change the value of
your text box.

HTH

Byron
-----Original Message-----
Can you help get me started on the function with case?
--
Brian


:

I would suggest that you might want to consider
writing
your own function that would evaluate all of the
options
and return the appropriate value instead of trying to
use
the Switch function. It sounds like you have multiple
evaluations that need to happen. You might try using a
Case statement in your function.

HTH

Byron

-----Original Message-----
I have the following as a text box control source
which
is close to working properly but not quite and I need
some help.

=Switch([Waive Service Call],"Waived",[Cancel Service
Call],"Canceled",[Rescheduled Service
Month],"Rescheduled",[Date Written Report Sent] Is Not
Null,"Completed",Not IsNull([Date Written Report
Sent]),"Completed",True,"Pending")

I have a database where all items are
considered "Pending" until some entry on a form is
completed. A person can check a box "Waive", they can
check a box "Cancel" or they can enter a date for a
field "Rescheduled". If a field "Date Written Report
Sent is filled out, then it is
considered "Completed".
The person can either check "Cancel" or Waive" and
that
might end the item. Entering a date in "Rescheduled"
field leaves it open still for all possibilities.
Filling out the date field "Date Written Report Sent"
ends the item as well.

I noticed issues where if a person filled the
Rescheduled Date out the report correctly shows
rescheduled but if they later filled out the Date
Written
Report Sent the field still shows Rescheduled and not
Completed as it should.

I also noticed that if you waive or cancel and then
for
some reason filled out Date Written Report Sent later
than it wil still say Waived or Canceled.

How do I improve the switch to account for those
possibilities? Do I need multiple if statements?

If I clear the first choice out of the form the other
choices then work but we need to be able to show the
trail in the report so multiple choices need to be
accounted for. I just need to write the correct
arguments.

--
Brian
.


.
.
 
B

Byron

Generally speaking, the code would be on the AfterUpdate
event or the OnChange event, but it could be on any event
that would fire at the time you need it to.

HTH

Byron
-----Original Message-----
Byron, actually by changing the order of the items in the
switch I was able to get it to work properly.
By the way, your option regarding code for every option,
where would it be placed and what might an example be for
future reference?
--
Brian


Byron said:
Brian,

I think that I would still take the approach that I
described in my previous reply. I do not think that you
can expect to get the results you are looking for using
the Switch function. I think that you are going to have
to have some code behind each of the options that the user
can use. You would then also be able to control which
options are available to the user after certain options
have been utilized. I sounds to me that you need to be
evaluating the situation after any entry by the user not
just evaluating a condition.

Byron
-----Original Message-----
It starts with all calls set up in our system
considered "Pending". Then a call can be completed by
entering a date on a form in Date Correspondence Sent.
This would "Complete" the call.
Instead of completing the call we can check a box to
either "Cancel" or "Waive" a call" we need to make by a
certain date. This should be the end status for this call
at this point.
The call could also be "Rescheduled" to another date
and
then later may be "canceled", "waived" or "completed".
This should then end the call status
The switch is used in the text box where I want the
words
either: "Pending", "Completed", "Waived", "Canceled"
or "Rescheduled" to appear depending on what the status
from above determines.
My switch takes care of some of the alternatives but
not
all as I mentioned. It does not take into account some
times one choice is made but then later a different choice
is selected.
Does this info help?

--
Brian


:

Brian,

I would need a little more information before attempting
to write the function.

Is there some kind of work flow to the fields you are
going to use to establisk the status?

Have you tried using the AfterUpdate event of each
of
the
various fields (controls) to set the value of your text
box control?

For example, when the user checks the "Waive" check box,
the code could set the value of your text box:

If me.NameOfWaiveChkBox = true then
me.YourTextBox = "Waived"
'here you could even disable other controls
'if desired.
End If

If you take this approach, you would need code like this
on each of your controls that will change the value of
your text box.

HTH

Byron
-----Original Message-----
Can you help get me started on the function with case?
--
Brian


:

I would suggest that you might want to consider
writing
your own function that would evaluate all of the
options
and return the appropriate value instead of
trying
to
use
the Switch function. It sounds like you have multiple
evaluations that need to happen. You might try
using
a
Case statement in your function.

HTH

Byron

-----Original Message-----
I have the following as a text box control source
which
is close to working properly but not quite and I need
some help.

=Switch([Waive Service Call],"Waived",[Cancel Service
Call],"Canceled",[Rescheduled Service
Month],"Rescheduled",[Date Written Report Sent]
Is
Not
Null,"Completed",Not IsNull([Date Written Report
Sent]),"Completed",True,"Pending")

I have a database where all items are
considered "Pending" until some entry on a form is
completed. A person can check a box "Waive",
they
can
check a box "Cancel" or they can enter a date for a
field "Rescheduled". If a field "Date Written Report
Sent is filled out, then it is
considered "Completed".
The person can either check "Cancel" or Waive" and
that
might end the item. Entering a date in "Rescheduled"
field leaves it open still for all possibilities.
Filling out the date field "Date Written Report Sent"
ends the item as well.

I noticed issues where if a person filled the
Rescheduled Date out the report correctly shows
rescheduled but if they later filled out the Date
Written
Report Sent the field still shows Rescheduled and not
Completed as it should.

I also noticed that if you waive or cancel and then
for
some reason filled out Date Written Report Sent later
than it wil still say Waived or Canceled.

How do I improve the switch to account for those
possibilities? Do I need multiple if statements?

If I clear the first choice out of the form the other
choices then work but we need to be able to show the
trail in the report so multiple choices need to be
accounted for. I just need to write the correct
arguments.

--
Brian
.


.


.
.
 

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