how to clear all controls on subforms in multiple tab pages

grane236

Registered User.
Local time
Tomorrow, 01:44
Joined
Nov 19, 2012
Messages
15
I have a clear (reset) controls button on each of my tab pages which clears all the controls in the subform on that page. However I would like to have just one button which clears all controls on all forms on all tab pages. Is this possible?

I have a save button which resides outside the individual tab pages on the main form control page and this works well. It saves all controls on every tab page. But the same doesnt seem to work for a clear button. The button has to be on every individual form tab page? Is this the case?

Thankyou,
Steve
 
Hi Isskint,
Thankyou for your reference. I can see how to reference other pages but my attempt to incorporate it into a clear controls request failed miserably. Any advice?
Thankyou.
  1. Dim ctl As Control<LI class=L4><LI class=L5> For Each ctl In Forms![Auditor Assessment Form]![Assessment details].Form.Controls<LI class=L6> Select Case ctl.ControlType<LI class=L7> Case acTextBox, acComboBox, acListBox, acCheckBox<LI class=L8> If ctl.ControlSource = "" Then<LI class=L9> ctl.Value = Null<LI class=L0> End If<LI class=L1> Case Else<LI class=L2> End Select<LI class=L3> Next ctl
    [*]End Sub
 
I think you may have to make each tab active before you can assign values to the controls.
 
Thanks Isskint,

You were right. My code now works on any page after I focus o it. I just need to loop my code through each page. I imagine this is easy but if you have any advice on how to do it I would be grateful.

focus on page 1
Forms![Auditor Assessment Form].TabCtl0.Pages(1).SetFocus
run code....
focus on page 2
Forms![Auditor Assessment Form].TabCtl0.Pages(2).SetFocus
run code..

etc
thankyou.
 
If you only have a couple of tabs, that is just as easy as any other method. If you had a lot of tabs you could enumerate through the tabs, something like this;

For TabLp = 1 to NumberOfTabs
Forms![Auditor Assessment Form].TabCtl0.Pages(TabLp).SetFocus
run code....
Next TabLp
 

Users who are viewing this thread

Back
Top Bottom