dbTalk Databases Forums  

Simple Ref Number (not autonumber)

comp.databases.ms-access comp.databases.ms-access


Discuss Simple Ref Number (not autonumber) in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Paul
 
Posts: n/a

Default Simple Ref Number (not autonumber) - 12-08-2010 , 06:33 AM






Sorry but I have got stuck on the simple things. Don't want to use
auto number. I have a REF Field starting at 101. I want to increment
this by 1 every time I enter a new record, thanks

Reply With Quote
  #2  
Old   
John Spencer
 
Posts: n/a

Default Re: Simple Ref Number (not autonumber) - 12-08-2010 , 07:43 AM






You can do so using VBA code to get the next number and assigning that number
to the field

The simplest way is to use an expression like the following. I would normally
use that expression in the before update event of form.
Me.txtRefControl = DMAX("REF","NameOFTable") + 1

The problem here is that in a multi-user environment it would be possible for
two users to get the same number depending on timing.


John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

On 12/8/2010 7:33 AM, Paul wrote:
Quote:
Sorry but I have got stuck on the simple things. Don't want to use
auto number. I have a REF Field starting at 101. I want to increment
this by 1 every time I enter a new record, thanks

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.