topdesk123
Programmer
Hi everyone,
I have created a procedure to take the values of check boxes and create a sentence that will eventually be used in a mail merge. In order for the "sentence" to read correctly (where does the last comma go, where does "and" go, etc) I have used many if...then statements, 50 to be exact. Unfortunately, the statement evaluates to "true" incorrectly in many cases.
Here's an example:
If Me![Walking Surfaces] = True Then
Me![sentence2] = "walking surfaces of your deck"
end if
If Me![Walking Surfaces] = True And Me![support posts] = True Then
Me![sentence2] = "walking surfaces of your deck and support posts"
end if
If Me![Steps] = True And Me![Walking Surfaces] = True Then
Me![sentence2] = "walking surfaces of your deck and steps"
end if
If Me![Walking Surfaces] = True And Me!Steps = True And Me![support posts] = True Then
Me![sentence2] = "walking surfaces of your deck, steps and support posts"
end if
If Me![Walking Surfaces] = True And Me![support posts] = True And Me![Railings] = True Then
Me![sentence2] = "walking surfaces of your deck, railings and support posts"
end if
If Me![Walking Surfaces] = True And Me![Steps] = True And Me![Fascia] = True Then
Me![sentence2] = "walking surfaces of your deck, fascia and steps"
end if
I have tried if...then....else....which seems to be even worse.
Does anyone have a better way to evaluate all of the different options? BTW: I trigger the event with a button currently - but hope to have it work after update.
Thanks so much in advance for your help!
Gina
I have created a procedure to take the values of check boxes and create a sentence that will eventually be used in a mail merge. In order for the "sentence" to read correctly (where does the last comma go, where does "and" go, etc) I have used many if...then statements, 50 to be exact. Unfortunately, the statement evaluates to "true" incorrectly in many cases.
Here's an example:
If Me![Walking Surfaces] = True Then
Me![sentence2] = "walking surfaces of your deck"
end if
If Me![Walking Surfaces] = True And Me![support posts] = True Then
Me![sentence2] = "walking surfaces of your deck and support posts"
end if
If Me![Steps] = True And Me![Walking Surfaces] = True Then
Me![sentence2] = "walking surfaces of your deck and steps"
end if
If Me![Walking Surfaces] = True And Me!Steps = True And Me![support posts] = True Then
Me![sentence2] = "walking surfaces of your deck, steps and support posts"
end if
If Me![Walking Surfaces] = True And Me![support posts] = True And Me![Railings] = True Then
Me![sentence2] = "walking surfaces of your deck, railings and support posts"
end if
If Me![Walking Surfaces] = True And Me![Steps] = True And Me![Fascia] = True Then
Me![sentence2] = "walking surfaces of your deck, fascia and steps"
end if
I have tried if...then....else....which seems to be even worse.
Does anyone have a better way to evaluate all of the different options? BTW: I trigger the event with a button currently - but hope to have it work after update.
Thanks so much in advance for your help!
Gina