You're getting that error because you are missing an End If inside the For...Next loop. You're also missing a closing End If (at least in the example you posted). Corrected code below;
Dim c As Control If Not Me.NewRecord Then For Each c In Me.Controls If c.Tag = "Vehicle" Or c.Tag = "Outsourced" Then If IsNull(c) Then c.Visible = False Else c.Visible = True End If End If Next c End If
-- _________
Sean Bailey
"Walter" wrote:
[Quoted Text] > The following code gives me the next without for error. What is wrong? > > Dim c As Control > > If Not Me.NewRecord Then > For Each c In Me.Controls > If c.Tag = "Vehicle" Or c.Tag = "Outsourced" Then > If IsNull(c) Then > c.Visible = False > Else > c.Visible = True > End If > > Next c > -- > Thanks for your help! > Walter
|