View Full Version : Disable a control VB question


bonekrusher
01-12-2006, 09:58 AM
Hi All,

I have a Form which allows a user to input. I want the user to use a certian order when filling them out. for example if "audStart" is not filled out then preceeding controls are disabled. When they do input data into "audStart" the next Control is Enabled. Does any know how to do this?


If IsNull(Me.AudStart) Then

Me.finny.Enabled = False
Me.res.Enabled = False
Me.comp.Enabled = False
Me.newaud.Enabled = False

else
end if

Matt Greatorex
01-12-2006, 10:07 AM
As each control loses focus, check that a value has been entered. If it has, enable the next control. If not, don't.

e.g. The following checks for Nulls, but you could alter it to also check for zero length strings (Me!{control} = "")

Dim Response as String

IIf(IsNull(Me!{control}), Response = "NO", Response = "YES")

If Response = "YES" Then
Me!{control}.Enabled = TRUE
Else
Me!{control}.Enabled = FALSE
End If

Any use?

bonekrusher
01-12-2006, 10:42 AM
Great - Thanks! Its working well

Bones