Ticking a check box

kabir_hussein

Registered User.
Local time
Today, 09:33
Joined
Oct 17, 2003
Messages
191
Hi i have been using the following code to make a check box tick it self . however it does not seem to work

here is the code i am using, it is basically if the textbox(text19) which is calculated via other textboxes is set to 0 then the checkbox will tick it self to state the order has been complete

Private Sub Text19_Change()
If [order1].Form!Text19 = "0" Then
[order].Form! OrderComplete = True

End If
End Sub

order1 is a sub form of order.

i have also added a screen shot of the form
 

Attachments

  • checkbox.jpg
    checkbox.jpg
    52 KB · Views: 156
Where is this code running from? Sounds like it's running from the subform. That could be your issue (and the fact that you have a space after the ! in this line: [order].Form! OrderComplete, and you are comparing the value of Text19 to "0" and not the value 0).

If you're running it from the subform, try this version:
Code:
Private Sub Text19_Change()
   If Me.Text19 = 0 Then
      Forms!Order!OrderComplete = True
   End If
End Sub
 
Since the checkbox is just a visual indicator of the records status it's pointless storing it in a table, use and unbound textbox or label instead
 
Hello

the check box does have other significiant as it will be used on a report. If a check box is not ticked this will mean it is still an outstanding order. This is linked to a query which is linked to a report

If you know what i mean

many thanks in advance
 
kabir,

It's not a character, how about:

If Me.Text19 = 0 Then ...

Or

If Forms![order1]![Text19] = 0 Then ...

Wayne
 
You are changing the status of the checkbox based on some other value which can be obtained elsewhere via queries/filters. Again, it's just a visual indicator and shouldn't be stored.
 
Hi

I have a textbox which is only used on the form, and is used so it can give users a visualise of how many items of one order have arrived. However I thought since this textbox can show how many items have arrived i could use this textbox to make the order complete checkbox set to yes if all items of one order has arrived. hence using the following code:

Private Sub Text19_Change()

If Forms![order1]![Text19] = 0 Then

Me.Parent!OrderComplete = True
Else
Me.Parent!OrderComplete = False
End If
End Sub

However this does not seem to make the checkbox tick itself or not

thanks
 

Users who are viewing this thread

Back
Top Bottom