Hi

I have a probably quite basic query which I have been able to handle 
in a crude way, but the user has requested a more refined way of 
handling the problem.

In a subform I have two fields, one textbox called 'attributename' 
and one checkbox called attributetype.  If the text entered in the 
attributename field matches the data in a table (tblAreaFieldName) 
and the attributetype is ticked, nothing needs to be done.  However, 
if the attributetype is ticked and the attributename text does not 
match the data in the tblAreaFieldName, a message has to be 
displayed to the user and another checkbox (areafield) ticked 
automatically.

The way I initially handled this was as follows, on the AfterUpdate 
event of the attributename:

******************************************************************
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
******************************************************************

This does the job, but as I said it is very crude and relies on 
someone amending the code every time a new area name is added to the 
list.  A neater way of doing this is to compare the value in the 
attributename field with the contents of the table.  Unfortunately 
my VBA skills are so rusty I can't remember how to do this: I have a 
vague idea about opening a recordset but would be extremely grateful 
for some help with this.

Thanks very much,
Sharon




------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a 
href="http://us.ard.yahoo.com/SIG=12h39f8ef/M=362335.6886445.7839731.1510227/D=groups/S=1705115370:TM/Y=YAHOO/EXP=1122987805/A=2894361/R=0/SIG=13jmebhbo/*http://www.networkforgood.org/topics/education/digitaldivide/?source=YAHOO&cmpgn=GRP&RTP=http://groups.yahoo.com/";>In
 low income neighborhoods, 84% do not own computers. At Network for Good, help 
bridge the Digital Divide!</a>.</font>
--------------------------------------------------------------------~-> 


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