Its a long story but i have designed a form where there are four check boxes per question - there are two columns (Left and Right) with two boxes in each - L1, L2, R1, R2. There are a 8 questions (each with 4 boxes) but it I get the first one down I should be fine
These represent the preferences for handedness.
These rules for ticking them are as follows:
1. If the user doesnt do the task he will keep all four boxes unticked
2. If the user doesnt have a preferences he needs to put a tick, one in each colum
3. If he has a strong preference for a particular task he needs to put two ticks in the column for the hand they he prefers
I have created code so that:
a. I can try and ensure that the participant follows these rules
b. The check-boxes can return a text response.
Here is what I have come up with so far:
Private Sub Q1L1_AfterUpdate()
If Me.Q1L1 = -1 And Me.Q1L2 = -1 Then
Me.Q1R1.Locked = True
Me.Q1R2.Locked = True
Me.Q1R1.Controls(0).ForeColor = RGB(221, 221, 221)
Me.Q1R2.Controls(0).ForeColor = RGB(221, 221, 221)
Me.Q1R1.Value = 0
Me.Q1R2.Value = 0
Me.Q1Answer.Value = "Strong Left"
Else
Me.Q1R1.Locked = False
Me.Q1R2.Locked = False
Me.Q1R1.Controls(0).ForeColor = RGB(0, 0, 0)
Me.Q1R2.Controls(0).ForeColor = RGB(0, 0, 0)
Me.Q1R1.Value = Null
Me.Q1R2.Value = Null
Me.Q1Answer.Value = Null
End If
If Me.Q1L1 = -1 And Me.Q1R1 = -1 Then
Me.Q1Answer.Value = "Neither Right nor Left"
Else
Me.Q1Answer.Value = Null
End If
If Me.Q1L1 = -1 And Me.Q1R2 = -1 Then
Me.Q1Answer.Value = "Neither Right nor Left"
Else
Me.Q1Answer.Value = Null
End If
End Sub
===============
The code successfully causes the right column for example to grey out if two ticks are in the left column and returns the value "Strong Left" for example to the text box.
I have a few issues:
1. I do not think the ifs and endifs are necessarily in the right place.
2. Now if I check on either R1 or R2 and then try to click on L1 so that I can return the text "Neither Right nor Left" it causes the R1/R2 box to uncheck.
but it doesnt happen the other way if I click L1 first and then R1/2 (I have put a code for this combination in yet).
THis code will have to be repeated for all the chekcboxes since even though logically the users will click from left to right, I cant be sure that they will.
Does anyone have any ideas?
UPDATE: I took out the endifs between conditions and replaced the ifs of the 2nd, 3rd and 4th conditions etc with elseif, and ended on a else statement. Its getting there but its not working properly. Its clearly the positions of the if, thens and elseifs thats the problem.
These represent the preferences for handedness.
These rules for ticking them are as follows:
1. If the user doesnt do the task he will keep all four boxes unticked
2. If the user doesnt have a preferences he needs to put a tick, one in each colum
3. If he has a strong preference for a particular task he needs to put two ticks in the column for the hand they he prefers
I have created code so that:
a. I can try and ensure that the participant follows these rules
b. The check-boxes can return a text response.
Here is what I have come up with so far:
Private Sub Q1L1_AfterUpdate()
If Me.Q1L1 = -1 And Me.Q1L2 = -1 Then
Me.Q1R1.Locked = True
Me.Q1R2.Locked = True
Me.Q1R1.Controls(0).ForeColor = RGB(221, 221, 221)
Me.Q1R2.Controls(0).ForeColor = RGB(221, 221, 221)
Me.Q1R1.Value = 0
Me.Q1R2.Value = 0
Me.Q1Answer.Value = "Strong Left"
Else
Me.Q1R1.Locked = False
Me.Q1R2.Locked = False
Me.Q1R1.Controls(0).ForeColor = RGB(0, 0, 0)
Me.Q1R2.Controls(0).ForeColor = RGB(0, 0, 0)
Me.Q1R1.Value = Null
Me.Q1R2.Value = Null
Me.Q1Answer.Value = Null
End If
If Me.Q1L1 = -1 And Me.Q1R1 = -1 Then
Me.Q1Answer.Value = "Neither Right nor Left"
Else
Me.Q1Answer.Value = Null
End If
If Me.Q1L1 = -1 And Me.Q1R2 = -1 Then
Me.Q1Answer.Value = "Neither Right nor Left"
Else
Me.Q1Answer.Value = Null
End If
End Sub
===============
The code successfully causes the right column for example to grey out if two ticks are in the left column and returns the value "Strong Left" for example to the text box.
I have a few issues:
1. I do not think the ifs and endifs are necessarily in the right place.
2. Now if I check on either R1 or R2 and then try to click on L1 so that I can return the text "Neither Right nor Left" it causes the R1/R2 box to uncheck.
but it doesnt happen the other way if I click L1 first and then R1/2 (I have put a code for this combination in yet).
THis code will have to be repeated for all the chekcboxes since even though logically the users will click from left to right, I cant be sure that they will.
Does anyone have any ideas?
UPDATE: I took out the endifs between conditions and replaced the ifs of the 2nd, 3rd and 4th conditions etc with elseif, and ended on a else statement. Its getting there but its not working properly. Its clearly the positions of the if, thens and elseifs thats the problem.
Last edited: