MsLady
Traumatized by Access
- Local time
- Today, 06:41
- Joined
- Jun 14, 2004
- Messages
- 438
I have five checkboxes on a form namely ck1, ck2, ck3, ck4, ck5.
A user can make more than one choice.
All the choices made should combine and go into one field into a table (ckboxes are not bound)
The checkboxes represent like this:
ck1 = "mango"
ck2 = "pear"
ck3 = "strawberry"
ck4 = "plum"
ck5 = "guava"
I want to have it so that when a user selects, for example: a combination of ck1, ck3 & ck5. My recordset reads: "mango, strawberry, guava".
when it selects ck2 & c1: "plum, mango". etc.
Now i have this part working and i am able to get correct fruit values into the table-field as text like "mango, strawberry, guava" if ck1, ck2, ck3 (combination) is selected.
Now, when a user goes back to update thier record from my form, I have no idea how to make sure the appropriate boxes are checked using the data in that field, so that they can update the check boxes. Since checkboxes only takes values of -1/0, yes/no, true/false, i run into problems on how to re-populate this checkboxes. say i have "mango, strawberry" in the field, i would like "ck1 & ck3) checked for the user to see and update.
What do you suggest? I need to have these fruity textvalues in my table-field, please help
This section to add ckboxes fruit values into my table:
Load the values back up: How?
Any thoughts? Please help
A user can make more than one choice.
All the choices made should combine and go into one field into a table (ckboxes are not bound)
The checkboxes represent like this:
ck1 = "mango"
ck2 = "pear"
ck3 = "strawberry"
ck4 = "plum"
ck5 = "guava"
I want to have it so that when a user selects, for example: a combination of ck1, ck3 & ck5. My recordset reads: "mango, strawberry, guava".
when it selects ck2 & c1: "plum, mango". etc.
Now i have this part working and i am able to get correct fruit values into the table-field as text like "mango, strawberry, guava" if ck1, ck2, ck3 (combination) is selected.
Now, when a user goes back to update thier record from my form, I have no idea how to make sure the appropriate boxes are checked using the data in that field, so that they can update the check boxes. Since checkboxes only takes values of -1/0, yes/no, true/false, i run into problems on how to re-populate this checkboxes. say i have "mango, strawberry" in the field, i would like "ck1 & ck3) checked for the user to see and update.
What do you suggest? I need to have these fruity textvalues in my table-field, please help

This section to add ckboxes fruit values into my table:
Code:
Dim ckboxes5 as string
Public Function getCkboxes5Values()
Dim ckbox5a As String, ckbox5b As String, ckbox5c As String, ckbox5d As String, ckbox5e As String
If Form_frmSurvey.ck1 = True Then ckboxes5a = "mango"
If Form_frmSurvey.ck2 = True Then ckboxes5b = "pear"
If Form_frmSurvey.ck3 = True Then ckboxes5c = "strawberry"
If Form_frmSurvey.ck4 = True Then ckboxes5d = "plum"
If Form_frmSurvey.ck5 = True Then ckboxes5e = "guava"
ckboxes5 = ckboxes5a & "," & ckboxes5b & ", " & ckboxes5c & ", " & ckboxes5d & ", " & ckboxes5e
End Function
rs.AddNew
rs.Fields("Person") = vUser
rs.Fields("Mnemonic") = vMnem
rs.Fields("Question") = 5
rs.Fields("Response") = ckboxes5
Load the values back up: How?
Code:
Private Sub loadValues()
On Error Resume Next
Dim sql As String, sql2 As String, rs As DAO.Recordset
sql = "select * from dbo_TS_Survey_Response where Person = """ & UserName() & """ and Mnemonic = """ & pMnem & """ Order By Question"
Set rs = CurrentDb.OpenRecordset(sql, 2)
'sql2 = "
If rs.RecordCount <> 0 Then
rs.MoveFirst
txtAnswer1.Value = rs(4)
rs.MoveNext
txtAnswer2.Value = rs(4)
rs.MoveNext
cboSelection3.Value = rs(4)
rs.MoveNext
txtAnswer4.Value = rs(4)
rs.MoveNext
[color=red]'to be edited for checkboxes values
'If ckboxes5 = "" Then
'if value value in field contains "mango" :(
ck1.Value = IIf(ckboxes5 = "*mango*", ck1.Value = True, ck1.Value = False)
ck1.Value = rs(4)
rs.MoveNext
txtAnswer6.Value = rs(4)
[/color]
End If
rs.Close
Any thoughts? Please help
