[AccessD] Autonumber/autoincrement

Stuart McLachlan stuart at lexacorp.com.pg
Tue Apr 26 17:09:18 CDT 2005


On 26 Apr 2005 at 15:44, Kaup, Chester A wrote:

> I have a database of oilfield injection wells. Periodically the wells
> are changed from injecting water to injecting CO2 or visa versa. The
> changes are independent from one well to the next. The records in the
> table have well name, cycle number, injection fluid type and date of
> change. I can build a form with drop down for well name and injection
> fluid type. I could also use a calendar control for the date. I would
> like the cycle number to fill in by itself based on the cycle number of
> the previous record for the well getting a new record. Can this be done
> using some kind of autoincrement? 
> 

You can do it by setting  CycleNumber to
DMax("CycleNumber","tblInjectionChanges","WellName = '" & cblWellname & 
"'") +1
Best place to do this is probably in the form's Before_Update event.



-- 
Stuart





More information about the AccessD mailing list