I have a form which has three fields in it (of relevance): a yes/no 
field called areafield, a text box called attribute and another 
yes/no field called differentareaname.

When a user ticks the 'areafield' box and enters the attribute name 
in the textbox, the text is to be checked against a list of possible 
attribute names.  If the areafield is false, or is true and the 
attribute text matches any of the data in the list, nothing needs to 
be done.  If the areafield is true and the attribute text doesn't 
match, the value of the differentareaname field is to be set to 
true.  My code for this checking is:

*************************************************************
Dim area As String
Dim areatrue As String

area = Me.attribute.Value
areatrue = Me.areafield.Value

    If areatrue = True Then
        If area = "AREA" Or area = "AREA0" Or area = "AREA_HA" Or 
area = "AREA_HA0" Or area = "HECTARES" Or area = "MEASURE" Or area 
= "SITEAREA" Or area = "STAT_AREA" Or area = "TOT_AREA" Then
            Exit Sub
        Else
            msgbox "This field name does not match existing field 
name", vbOKOnly
            Me.DifferentAreaName.Value = True
        End If
    End If
*************************************************************

The problem I am having is that when I tick the areafield checkbox 
then enter the attribute name as something other than what is in the 
list, I get a type mismatch error when I exit the attribute field.  
If I then delete the record I created, and tick the areafield in the 
next new record, I get a type mismatch error when I tick the 
checkbox as well as when I enter the unmatched attribute.  I am at a 
loss as to see why.

Any suggestions would be gratefully received.

Thanks
Sharon





Please zip all files prior to uploading to Files section. 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AccessDevelopers/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to