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 box triggers others

Status
Not open for further replies.

hlkelly

Technical User
Jul 11, 2003
108
US
I have a form with a subform. After the user checks a box on the main form, I would like check boxes for all of the items in the subform to subsequently be checked.

(it's an order form - when they check 'deactivate' on the main form, i need the order detail records to also be deactivated so that the inventory report is not affected by underlying queries).

any ideas helpful!

thanks!
 
How ae ya hlkelly . . .

Need a little more info:
[ol][li]The subforms [blue]Link Master and Link Child[/blue] field names?[/li]
[li]The [blue]TableName[/blue] the subform is based on?[/li]
[li]The [blue]checkbox fieldname[/blue] in the table above?[/li]
[li]The [blue]subFormName[/blue]?[/li]
[li]The mainforms [blue]checkbox name[/blue]?[/li][/ol]
An SQL update query is my intention.

[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Main form: tblOrders
Subform: frmOrderDetailschangeorder
Main form check box: Deactivate
Subform check box: DeactivateItem
Subform table: tblOrderDetails
Main form table: tblOrders

I've tried a bunch of stuff but I'm not referencing the forms correctly. Access cannot find the forms...

Thanks!!!
 
You really have a form named tblOrders like the table ?
Which code exhibit the error you mentioned ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
i do have a form called that...i was new when i first designed this thing and didn't think to change it...

here is the code i have at this very moment.

Private Sub Deactivate_AfterUpdate()
Me![DeactivateDate] = Date
Forms!frmchangeorder! me.[DeactivateItem] = True
End Sub

the check box inserts the current date into a field on the main form. i need it to check the deactiveitem check box on the subform true as well.
 
here's the code i have NOW. can't find the field deactivateitem is the error i receive:

Private Sub Deactivate_AfterUpdate()
Me![DeactivateDate] = Date
Forms![frmchangeorder]![DeactivateItem].Form![frmOrderDetailschangeorder] = True
End Sub

(the first part of the code works fine and populates the deactivate date with today's date)

 
I'd try this:
Me!frmOrderDetailschangeorder.Form!DeactivateItem = True

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
can't find 'deactivateitem'

Private Sub Deactivate_AfterUpdate()
Me![DeactivateDate] = Date
Me!frmOrderDetailschangeorder.Form!DeactivateItem = True
End Sub
 
Use the expression builder to find the correct spelling.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
i'm just incredibly dumb...thanks for your help.

i have it almost entirely working. here is the next problem.

in the subform, i have any number of checkboxes. the subform is actually an order form that may contain any number of checkboxes related to any number of items that may be listed there. i need ALL of the check boxes that may be there (varies) to be checked and not just the first item. make sense?

so, this code works but it only checks the first item:

Private Sub Deactivate_AfterUpdate()
Me![DeactivateDate] = Date
Me.sbfrmOrderDetails.Form.DeactivateItem = True
End Sub
 
You may try this:
Code:
Private Sub Deactivate_AfterUpdate()
Me![DeactivateDate] = Date
With Me!sbfrmOrderDetails.Form.RecordSet
  .MoveFirst
  While Not .EOF
    .DeactivateItem = True
    .MoveNext
  WEnd
End With
End Sub

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top