Prev: nada1
Next: Access Not Responding
From: Sharkbyte on 20 Apr 2010 16:02 I'm running the following code: For Each ctl In frm.Controls With ctl If .ControlType = acTextBox Then If .Tag = 2 Then Else .Enabled = True .Value = .DefaultValue End If End If End With Next I'm getting an error, on .Value, for a control identified only by acTextBox returning a value of 109. Is there a way to identify which control is being referenced? Thanks for your help. Sharkbyte
From: Bill Mosca on 20 Apr 2010 16:43 Sharkbyte Sure. Make sure any "On Error GoTo..." line is commented out. When the error happens the code will break. hover your mouse pointer over ctl and it should show the name. If not, when the code breaks type ?ctrl.Name in the immediate window (press Ctrl+G to open the window) and press Enter. -- Bill Mosca, Microsoft Access MVP http://www.thatlldoit.com "Sharkbyte" wrote: > I'm running the following code: > > For Each ctl In frm.Controls > With ctl > If .ControlType = acTextBox Then > If .Tag = 2 Then > Else > .Enabled = True > .Value = .DefaultValue > End If > End If > End With > Next > > I'm getting an error, on .Value, for a control identified only by acTextBox > returning a value of 109. > > Is there a way to identify which control is being referenced? > > Thanks for your help. > > Sharkbyte
From: InvisibleDuncan on 22 Apr 2010 04:10 Alternatively, if you've got too many layers of error handlers, write the control's name to a variable and get your error handler to output that: On Error GoTo ErrorHandler For Each ctl In frm.Controls With ctl If .ControlType = acTextBox Then If .Tag = 2 Then Else .Enabled = True strControlName = .Name .Value = .DefaultValue End If End If End With Next ErrorHandler: MsgBox(strControlName ) "Bill Mosca" wrote: > Sharkbyte > > Sure. Make sure any "On Error GoTo..." line is commented out. When the error > happens the code will break. hover your mouse pointer over ctl and it should > show the name. If not, when the code breaks type ?ctrl.Name in the immediate > window (press Ctrl+G to open the window) and press Enter. > > > -- > Bill Mosca, Microsoft Access MVP > http://www.thatlldoit.com > > > "Sharkbyte" wrote: > > > I'm running the following code: > > > > For Each ctl In frm.Controls > > With ctl > > If .ControlType = acTextBox Then > > If .Tag = 2 Then > > Else > > .Enabled = True > > .Value = .DefaultValue > > End If > > End If > > End With > > Next > > > > I'm getting an error, on .Value, for a control identified only by acTextBox > > returning a value of 109. > > > > Is there a way to identify which control is being referenced? > > > > Thanks for your help. > > > > Sharkbyte
|
Pages: 1 Prev: nada1 Next: Access Not Responding |