Sharon,
 
    My sample db named AppendSequence might be of interest to you. It is available at Rogers Access Library (other developers library). Link - http://www.rogersaccesslibrary.com
 
    You could adapt the underlying approach suitably, for your specific needs.
 
Best wishes,
A.D.Tejpal
 
----- Original Message -----
From: seworkuk
Sent: Monday, December 19, 2005 22:00
Subject: [AccessDevelopers] Increment a number by 1

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



Please zip all files prior to uploading to Files section.




YAHOO! GROUPS LINKS




Reply via email to