How concatenate field data

I have a form which contains 6 checkboxes.  If for example, checkbox 1 is true then a text field next to it is populated with "Apple".  If checkbox 2 is true then a textbox next to it is populated with "Orange".  If checkbox 3 is true then a textbox next to it is populated with "Banana".  If checkbox 4 is true then a textbox next to it is populated with "Pear".  If checkbox 5 is true then a textbox next to it is populated with "Grapes".  If checkbox 6 is true then a textbox next to it is populated with "Kiwi".  All of the checkboxes and text boxes are in a table that the form is using as its record source.

Then there is a field on a report that I need to have data concatenated into depending on the fields that have data in them based on those checkboxes.  In each case the data would be separated with "OR".  In addition to this there is static text before and after the concatenated string.  The first part would always be "The fruits available are" and the last part is "for you."

So, for example, if checkbox 1 and 3 and 4 were true, then the result in the concatenated field would be:

"The fruits available are Apple OR Banana OR Pear for you."

What would the VBA code be to make this happen on the report?  The trick seems to be getting rid of "OR" if there is no data in a field.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
Dim strFruits as string

 strFruits = ""

 If Me.chkBox1 = True then
    strFruits = strFruits "OR Apple"
End If

 If Me.chkBox2 = True then
    strFruits = strFruits "OR Orange"
End If

' rem and so on
' Then

' Strip off the first OR
If strFruits<>"" then
  strFruits = Mid$(strFruits,4)
  strMessage = "The fruits available are " & strFruits & " for you"
  strMessage "No fruits for you"
End If

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SteveL13Author Commented:
Absolutely perfect.  Thanks.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.