[AccessD] Code help please

Joe Hecht jmhecht at earthlink.net
Sun Jul 1 22:42:20 CDT 2007


I will take a look.

Still would prefer to code the required field by field.

Joe Hecht
jmhecht at earthlink.net

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Steve Schapel
Sent: Sunday, July 01, 2007 8:35 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Code help please

Hi Joe,

I think there are two approaches you could take here.

First approach...

Go to the design view of the table.  Set the Required property for all 
these fields to No.  Select 'Properties' from the View menu.  In the 
Validation Rule property, something like this...

([job title]="admin") Or ([Issueing agency] Is Not Null And [Licenseexp] 
Is Not Null And [dotExpdate] Is Not Null)

Validation Text property can be set as required.  This assumes no 
Default Values.

Second approach...

Code on the Before Update event of the form, for example...

  If Me.job_title <> "admin" Then
     If IsNull(Me.Issueing_agency + Me.Licenseexp + Me.dotExpdate) Then
        MsgBox "Some stuff missing"
     End If
  End If


Regards
Steve


Joe Hecht wrote:
> Hi all wise and mighty list.
> 
>  
> 
> A2k3
> 
>  
> 
> I have a field job title.
> 
>  
> 
> All job titles require license information unless job tile = admin
> 
>  
> 
> Silly me I set required in table rules.
> 
>  
> 
> I need some code that says something like
> 
>  
> 
> If job title  <> "admin" (string)
> 
>  
> 
> Then
> 
>  
> 
> Issueing agency .required = true
> 
> Licenseexp.required = true
> 
> dotExpdate.required =true
> 
>  
> 
> I do not see a .required property that I can set in code.
> 
>  
> 
> TIA
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
> Joe Hecht
> 
> jmhecht at earthlink.net
> 
>  
> 
-- 
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