A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

increment number field



 
 
Thread Tools Display Modes
  #1  
Old April 28th, 2004, 09:36 PM
external usenet poster
 
Posts: n/a
Default increment number field

I need to increment a number field in a table that will
work like auto number but I have data that was migrated
from Lotus Approach so I can not use auto number. Does
anyone have a routine to do this? I also have a problem
pre populating a field and get ENTER PARAMETER VALUE the
error is (can't find value asked for input)
  #2  
Old April 29th, 2004, 06:33 AM
John Vinson
external usenet poster
 
Posts: n/a
Default increment number field

On Wed, 28 Apr 2004 13:36:59 -0700, "
wrote:

I need to increment a number field in a table that will
work like auto number but I have data that was migrated
from Lotus Approach so I can not use auto number. Does
anyone have a routine to do this?


If you do your data entry in a table datasheet... don't; the table has
no usable events. Instead use a Form. In its BeforeInsert event put
code like

Private Sub Form_BeforeInsert(Cancel as Integer)
Me!txtID = NZ(DMax("[ID]", "[your-table-name]")) + 1
End Sub

I also have a problem
pre populating a field and get ENTER PARAMETER VALUE the
error is (can't find value asked for input)


Please post your code.

John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public
  #3  
Old April 29th, 2004, 11:29 PM
Tim Ferguson
external usenet poster
 
Posts: n/a
Default increment number field

" wrote in
:

I need to increment a number field in a table that will
work like auto number but I have data that was migrated
from Lotus Approach so I can not use auto number.


Yes you can. You can append records into a table and preserve any values
that go into an autonumber field (allowing, of course for key violations).
This works just fine, for example

INSERT INTO MyTable (MyAutonumber)
VALUES (1022);

and you can do the same by inserting a set of records from another SELECT
query. The autonumber seed will be set to the next highest number (unless
that is lower that whatever it already was, if you see what I mean).

Hope that helps


Tim F

 




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 Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:23 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.