[AccessD] Looping through control names

Nancy Lytle lytlenj at yahoo.com
Fri Jul 16 13:23:14 CDT 2004


Thank you to all who replied, I am not there 100% but
with that last bit from Doris (how's it going?), I am
on my way to a very nice solution that will highlight
the fields that need to be addressed all at once.  I
might even see about rearranged the tab order or
something to make it a little easier on the data entry
people.
Again many thanks, I dreaded the idea of having to go
into a ton of forms and write code for each field in
that form.  I think this will work fine.  When I get
it working the way I want I will post it back.
Again, Many Thanks,
Nancy

--- Mike & Doris Manning <mikedorism at adelphia.net>
wrote:
> If IsNull(ctl.Value) Then
> 
> Doris Manning
> Database Administrator
> Hargrove Inc.
> www.hargroveinc.com
> 
> 
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On
> Behalf Of Nancy Lytle
> Sent: Friday, July 16, 2004 1:43 PM
> To: Access Developers discussion and problem solving
> Subject: RE: [AccessD] Looping through control names
> 
> 
> Thanks for the idea but even if I change that line
> to 
> 
> If IsNull(ctl.Name.Value) Then
> 
> it still errors on "Object Required".
> 
> It should be "thinking"
> Is the value held in the control mndCmdCutomer null?
> 
> Instead it is thinking
> Is "null" (ctl.name.value) null
> 
> TIA
> Nancy
> 
> 
> --- "Colby, John" <JColby at dispec.com> wrote:
> > 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
> > -- 
> > _______________________________________________
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> >
> http://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> > 
> 
> -- 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 
> -- 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 




More information about the AccessD mailing list