Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

check all check box based on 0ne master

Status
Not open for further replies.

dixxy12

Technical User
Jun 18, 2007
45
CA
Hi,

I would like to know if there is a way to check a checkbox in every record base on 1 check box outside that form?

The main form has the checkbox 'chkReceivedAll' and the subform 'frmReceivedSud' has a checkbox on every record call 'chkReceived'.

So when the user check the 'main' checkbox i would like that all checkboxes in the subform to be'check'.

I'm playing with this code with not much luck:
Code:
Dim ctr As Control
Dim FirstNull As CheckBox
For Each ctr In Me.Controls
If ctr.ControlType = acCheckBox Then
  If IsNull(ctr) Then
    If FirstNull = "" Then
    ctr.SetFocus
    ctr.Checked = True
    End If
  FirstNull.Value = True
  End If
End If
Next
Can this be done?

Thanks
 
this is the message in the immediate window:

UPDATE tblPODoorHistory SET [Received] = -1 WHERE [tblPODoorHistory]![PONumber] = 9999-003;
 
It looks like your PONumber is a text field, is that correct? If so, you need some single quotes:

Code:
strSQL = "UPDATE tblPODoorHistory " & _
         "SET [Received] = " & Me.chkAllRec & _
         " WHERE [tblPODoorHistory]![PONumber] = '" & Me!cboDoorPO & "'"
 
those darn single quotes will get you EVERY time right????

so just to make sure i understand. when dealing with a text feild we need to have single quotes? right?

if the field is numeric no single quotes?

Thanks so much for your help
 
That is right, with one small extra problem: if it is a date you need hash signs (#).
 
Got it!!!! thanks again for your help on this one

Thanks to AceMan also.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top