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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Control text box on mainform by a checkbox on the subform 1

Status
Not open for further replies.

integritycare

Technical User
Mar 12, 2011
151
AU
The question is this,
Is it possible to change the status of a text box on a mainform by a checkbox on the subform.

The Mainform is "Form25", the Subform is "Form26"
On the mainform there is a text box from the subform as follows;
Control Source =[form26].[Form]![T1] (shows a status which has data from a combobox)

The main form has a textbox "ACS" (shows the status of an invoice)

I want to update the data in the textbox "ACS" on the mainform by using a controlled checkbox on the subform

The checkbox on the subform is "ADD" and the After update event is:
If Add then

????????????

Else
End if

End Sub


Just don't know how to write the code to do this.

Many thanks,

Integ

 
I would change the name of the check box to chkAdd since "Add" might be a reserved word in this context.
Code:
If Me.chkAdd then
   Me.Parent.ACS = "...?..."
  Else 
End if

Duane
Hook'D on Access
MS Access MVP
 
Code:
Private Sub Add_AfterUpdate()
If forms![Form25]![Form26]!Add = -1 then 'Checked
forms!Form25!ACS = "Paid"
Else 'unchecked
forms!Form25!ACS = "Pending"
End if
End Sub

As a side, I would take dhookom's advice and make the control name more unique.
 
Dhookom's solution is definately more eloquent than mine, but I'm a hack and my way helps me see exactly whats going on where when the code gets longer and longer.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top