Check box to information to Text field

  • Thread starter Thread starter Sokki Hong
  • Start date Start date
S

Sokki Hong

Hello, I currently have a multiple check boxes set up on a
form where when the user clicks a box labeled, "Billing"
and another check box called "Checks" it will input the
following in the text field:

Billing, Checks,

The code I used for each of the check box is the following:

If Form.[Billing] = True Then
Form.Area = Form.Area & "Billing, "
Else
Form.Area = Replace(Form.Area & " ", "Billing, ", "")
End If

As you can see I would prefer to take out the comma at the
end after the user is done selecting all of the desired
check boxes. Also, I would like to take the comma before
the last selection as well and add the sign "&" before the
last word. Any clue on how I can do one or all of these
items?
 
-----Original Message-----
Hello, I currently have a multiple check boxes set up on a
form where when the user clicks a box labeled, "Billing"
and another check box called "Checks" it will input the
following in the text field:

Billing, Checks,

The code I used for each of the check box is the following:

If Form.[Billing] = True Then
Form.Area = Form.Area & "Billing, "
Else
Form.Area = Replace(Form.Area & " ", "Billing, ", "")
End If

As you can see I would prefer to take out the comma at the
end after the user is done selecting all of the desired
check boxes. Also, I would like to take the comma before
the last selection as well and add the sign "&" before the
last word. Any clue on how I can do one or all of these
items?
.

How about this:
If IsNull(Form.Area) Then
Form.Area = "Billing"
Else
Form.Area = Replace(Form.Area," & ",", ")
Form.Area = Form.Area & " & Billing"
End If
 
Back
Top