BearsInNeed
New member
- Local time
- Yesterday, 16:15
- Joined
- Aug 6, 2013
- Messages
- 6
Hello there!
I have the following problem:
I have a form that automatically puts a value into a field if I click a checkbox. So far, so good. I want the field to say 0, unless the check box is clicked, in which case it will automatically write 12 into the field. I wrote a piece of code that does almost that. But as the action taken is ‘click’ it only puts the 0 in, when I click and unclick the checkbox. I can’t figure out how to write something like: I want this field to say 0, unless I click the Check box, in which case I’d like the field to say 12.
This is the code that I came up with:
Private Sub Tablecloth_Click()
If [Forms]![Bare campsite Data Entry Form]![Tablecloth] = -1 Then
[Forms]![Bare campsite Data Entry Form]![Tablecloth_hazard] = 12
Else
[Forms]![Bare campsite Data Entry Form]![Tablecloth_hazard] = 0
End If
End Sub
I am a complete novice but somehow got into the situation where I have to build this database from scratch and I want it to be neat, self explanatory and highly functional, as other people will be using it.
To put it mildly, I’m in over my head, so would appreciate any help.
Thank you!
I have the following problem:
I have a form that automatically puts a value into a field if I click a checkbox. So far, so good. I want the field to say 0, unless the check box is clicked, in which case it will automatically write 12 into the field. I wrote a piece of code that does almost that. But as the action taken is ‘click’ it only puts the 0 in, when I click and unclick the checkbox. I can’t figure out how to write something like: I want this field to say 0, unless I click the Check box, in which case I’d like the field to say 12.
This is the code that I came up with:
Private Sub Tablecloth_Click()
If [Forms]![Bare campsite Data Entry Form]![Tablecloth] = -1 Then
[Forms]![Bare campsite Data Entry Form]![Tablecloth_hazard] = 12
Else
[Forms]![Bare campsite Data Entry Form]![Tablecloth_hazard] = 0
End If
End Sub
I am a complete novice but somehow got into the situation where I have to build this database from scratch and I want it to be neat, self explanatory and highly functional, as other people will be using it.
To put it mildly, I’m in over my head, so would appreciate any help.
Thank you!