hijacked101
New member
- Local time
- Today, 19:16
- Joined
- Sep 4, 2008
- Messages
- 7
I am creating a database and i would like to assign a piece of code to a command button, so that when it is pressed it generated an automated value for a text box based on tick boxes on the forum.
I attempted to do something like the following:
Private Sub Command130_Click()
if me.tickbox1.value = 0 then
me.textbox1.value = "tickbox one was left blank. "
End If
If me.tickbox2.valuse = 0 then
me.tectbox1.value = "tickbox two was left blank. "
end if.
End sub
upon clicking the command button when both tickboxes are unticked i get the following:
"tickbox two was left blank"
My desired results for when both tick boxes are left unticked is the following:
"tickbox one was left blank. tickbox two was left blank"
I am now trying to get my results by doing something like the following:
me.textbox.value = ((if me.tickbox1.value = 0 then
me.textbox1.value = "tickbox one was left blank. "
End If) (
If me.tickbox2.valuse = 0 then
me.tectbox1.value = "tickbox two was left blank. "
end if.)
End sub
but vb in access does not allow me to do this saying there is an expression missing.
As i have quite a few more than 2 tick boxes on the form, i do not want to create an if statement for each combonation of the tickboxes. Is there a way that i can do this without using a different if statement for each combonation?
I attempted to do something like the following:
Private Sub Command130_Click()
if me.tickbox1.value = 0 then
me.textbox1.value = "tickbox one was left blank. "
End If
If me.tickbox2.valuse = 0 then
me.tectbox1.value = "tickbox two was left blank. "
end if.
End sub
upon clicking the command button when both tickboxes are unticked i get the following:
"tickbox two was left blank"
My desired results for when both tick boxes are left unticked is the following:
"tickbox one was left blank. tickbox two was left blank"
I am now trying to get my results by doing something like the following:
me.textbox.value = ((if me.tickbox1.value = 0 then
me.textbox1.value = "tickbox one was left blank. "
End If) (
If me.tickbox2.valuse = 0 then
me.tectbox1.value = "tickbox two was left blank. "
end if.)
End sub
but vb in access does not allow me to do this saying there is an expression missing.
As i have quite a few more than 2 tick boxes on the form, i do not want to create an if statement for each combonation of the tickboxes. Is there a way that i can do this without using a different if statement for each combonation?