Colby, John
JColby at dispec.com
Fri Jul 16 12:26:43 CDT 2004
if isnull(somevalue) then
do something
JWC
-----Original Message-----
From: Nancy Lytle [mailto:lytlenj at yahoo.com]
Sent: Friday, July 16, 2004 1:18 PM
To: Access Developers discussion and problem Solving
Subject: [AccessD] Looping through control names
I am trying to make the users fill in a whole set of
fields when they do data entry - almost all fields in
the form must be filled in - this is a new
requirement.
I thought the easiest way would be to loop through the
controls that are mandatory (prefixed with mnd) and if
there is one that is null or an empty string to
require them to go back and fill it in.
Where I am stuck is on checking the value of the data
in the control. It doesn't like my code below.
I know I must be missing something simple but I can't
quite get it.
Any help appreciated.
Nancy
CODE:
Dim ctl As Control
For Each ctl In Forms!LCN1
'Find the mandatory fields
If left(ctl.Name, 3) = "mnd" Then
'Check to see if the mandatory field is null
PROBLEM:"object required>
If ctl.Name.Value Is Null Then
END PROBLEM (I hope:))
'Tell them to go back and fill it in
MsgBox "You must enter a value for the
field: " & ctl.Name
' ctl.Name.SetFocus
Exit Sub
Else
'If it is not null then end
End If
Else
'if it is not mandatory
End If
Next
'Check next control
--
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com