I have a table which already has an autonumber field, however I want 
to be able to update another field by 1 every time a new record is 
added.  Users add new records via a form.  I have tried the following 
code in the OnCurrent event of the form:

********************************************************************
Dim dbs, rst
Set dbs = OpenDatabase("database.mdb")

Set rst = dbs.OpenRecordset("select max(geo_ref_object_type_id) from 
tbldatasetinformation;")

rst.MoveLast

Forms!frmAdd!frmDatasetInformation.Form!Geo_ref_object_type_id.Value 
= rst + 1
********************************************************************

but I get a Type Mismatch error message.  My brain has shrivelled to 
the size of a pea today and I can't think what is wrong with this.  
Is there an easier way to do it?

Thanks
Sharon





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/u8TY5A/tzNLAA/yQLSAA/q7folB/TM
--------------------------------------------------------------------~-> 


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