How t o reference a specific control from a function


L

LAS

I'm creating a function to empty all the detail controls in any form unless
they have a control source. I'm copying most of this from
http://www.tek-tips.com/faqs.cfm?fid=5010 (very good little article). I
can't figure out if there's a way to reference a specific control, which all
of my forms will have, without naming the form variable, even though I'm in
a WITH structure. Is there a way?

With frmSomeForm
frmSomeForm("txtFocus").SetFocus CAN I AVOID NAMING THE
FORM

VARIABEL HERE, SINCE I'M IN A WITH STRUCTURE?
For Each ctl In .Detail.Controls
If ((ctl.ControlType = acTextBox) _
Or (ctl.ControlType = acCheckBox) _
Or (ctl.ControlType = acComboBox) _
Or (ctl.ControlType = acListBox)) _
And (Left$(ctl.ControlSource, 1) <> "=") Then
ctl.Value = Null
End If
Next ctl
End With
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top