473,418 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,418 software developers and data experts.

Autoincrement to Long

Tim
Hello All, I could use some help on an error that is just now popping it's
head up.

Seems that the autoincrement numeric has hit 32,767. The autoincrement is
used in various locations in the database, but in this case (log sheets), we
have hit 32k log entries over the past 2 years.

Is there a simple switch to set the autoincrement from integer to long
integer?

While I need to take care of this problem relatively quickly so that the log
sheets can be entered, I also need to solve how this error using
autoincrement will affect other areas of the database using that feature.
So hopefully it is just a matter of telling the autoincrement that it is now
a long integer instead of an integer; therefor just a blind spot I didn't
see coming 2 years ago that we would hit 32,000 entries. :-)

At least that is my hope. I did a quick google/groups search on increment
converting to long, and got a topic where the discussion was about
converting autoincrement to long, but you lose the ability to autoincrement.
That was a quick view and am still looking at other threads to see if this
really can be done. I don't want to lose AutoIncrement, but I also have
areas in the database that will also hit 32,767 entries at some point in the
future, so this has to be addressed.

Any helpful suggestions, reads, or instructions on a fix?

Tim
Aug 27 '07 #1
4 2431
Tim
Ok, after getting a chance to get in the database to find out what is wrong,
here is what is really the problem; my self-made increment feature. :-)

Private Sub Form_BeforeUpdate(Cancel As Integer)
'
If Me.NewRecord Then
'
Dim intTestCount As Integer
Dim intNextCount As Integer
Dim strCounterName As String
'
strCounterName = "invLineCount"
intTestCount = Nz(DLookup("[nxtCountInteger]", "tblCounter",
"[nxtCountName] = '" & strCounterName & "'"))
intNextCount = intTestCount + 1
[invlineId] = intNextCount
CurrentDb.Execute "UPDATE tblCounter SET nxtCountInteger = " &
intNextCount & " WHERE [nxtCountName] = '" & strCounterName & "'"
'
End If
'

End Sub
As I remember back 2 years ago, I am reminded that I created my own
'autoincrement' feature, not the internal AutoNumber system that Access has.
But it still brings us back to the problem of Integer count only allowed to
hit 32,767 and can not proceed higher. So the field it is going into is a
Long, and all is fine there it looks like, I just need to convert this
routine to use LongIntegers and be up and running.

Can I just change the routine from As Integer, to As Long; and all will be
fine?

I will verify all locations in the database where this self autoincrement
feature is used and can change the integer to long; but I will also make
sure the field where the number is being held also is set for a Long.

Any consequences I am not seeing by just changing the Integer to Long?

Tim



"Tim" <no*****@noemail.comwrote in message
news:c-******************************@comcast.com...
Hello All, I could use some help on an error that is just now popping
it's head up.

Seems that the autoincrement numeric has hit 32,767. The autoincrement is
used in various locations in the database, but in this case (log sheets),
we have hit 32k log entries over the past 2 years.

Is there a simple switch to set the autoincrement from integer to long
integer?

While I need to take care of this problem relatively quickly so that the
log sheets can be entered, I also need to solve how this error using
autoincrement will affect other areas of the database using that feature.
So hopefully it is just a matter of telling the autoincrement that it is
now a long integer instead of an integer; therefor just a blind spot I
didn't see coming 2 years ago that we would hit 32,000 entries. :-)

At least that is my hope. I did a quick google/groups search on increment
converting to long, and got a topic where the discussion was about
converting autoincrement to long, but you lose the ability to
autoincrement. That was a quick view and am still looking at other threads
to see if this really can be done. I don't want to lose AutoIncrement,
but I also have areas in the database that will also hit 32,767 entries at
some point in the future, so this has to be addressed.

Any helpful suggestions, reads, or instructions on a fix?

Tim


Aug 27 '07 #2
Tim wrote:
Ok, after getting a chance to get in the database to find out what is wrong,
here is what is really the problem; my self-made increment feature. :-)

Private Sub Form_BeforeUpdate(Cancel As Integer)
'
If Me.NewRecord Then
'
Dim intTestCount As Integer
Dim intNextCount As Integer
Dim strCounterName As String
'
strCounterName = "invLineCount"
intTestCount = Nz(DLookup("[nxtCountInteger]", "tblCounter",
"[nxtCountName] = '" & strCounterName & "'"))
intNextCount = intTestCount + 1
[invlineId] = intNextCount
CurrentDb.Execute "UPDATE tblCounter SET nxtCountInteger = " &
intNextCount & " WHERE [nxtCountName] = '" & strCounterName & "'"
'
End If
'

End Sub
As I remember back 2 years ago, I am reminded that I created my own
'autoincrement' feature, not the internal AutoNumber system that Access has.
But it still brings us back to the problem of Integer count only allowed to
hit 32,767 and can not proceed higher. So the field it is going into is a
Long, and all is fine there it looks like, I just need to convert this
routine to use LongIntegers and be up and running.

Can I just change the routine from As Integer, to As Long; and all will be
fine?

I will verify all locations in the database where this self autoincrement
feature is used and can change the integer to long; but I will also make
sure the field where the number is being held also is set for a Long.

Any consequences I am not seeing by just changing the Integer to Long?

Tim



"Tim" <no*****@noemail.comwrote in message
news:c-******************************@comcast.com...
>>Hello All, I could use some help on an error that is just now popping
it's head up.

Seems that the autoincrement numeric has hit 32,767. The autoincrement is
used in various locations in the database, but in this case (log sheets),
we have hit 32k log entries over the past 2 years.

Is there a simple switch to set the autoincrement from integer to long
integer?

While I need to take care of this problem relatively quickly so that the
log sheets can be entered, I also need to solve how this error using
autoincrement will affect other areas of the database using that feature.
So hopefully it is just a matter of telling the autoincrement that it is
now a long integer instead of an integer; therefor just a blind spot I
didn't see coming 2 years ago that we would hit 32,000 entries. :-)

At least that is my hope. I did a quick google/groups search on increment
converting to long, and got a topic where the discussion was about
converting autoincrement to long, but you lose the ability to
autoincrement. That was a quick view and am still looking at other threads
to see if this really can be done. I don't want to lose AutoIncrement,
but I also have areas in the database that will also hit 32,767 entries at
some point in the future, so this has to be addressed.

Any helpful suggestions, reads, or instructions on a fix?

Tim
Get everyone out for a quick change and set the numeric type to Long for
that field in the database tables.

Then anyplace you dim the var to int instead of long change to long. I
doubt there's many locations you'll need to do that.
Aug 27 '07 #3
Tim
"Salad" <oi*@vinegar.comwrote in message
>Any consequences I am not seeing by just changing the Integer to Long?
Get everyone out for a quick change and set the numeric type to Long for
that field in the database tables.

Then anyplace you dim the var to int instead of long change to long. I
doubt there's many locations you'll need to do that.
That is what I was thinking. I think there may be about 8 locations that I
can find and change them. I just didn't know if it would change anything
when going from Integer to Long. Didn't want to find any 'gotchas' for
something that seems so simple.

Thank you for the reply.

Tim
Aug 27 '07 #4
"Tim" <no*****@noemail.comwrote:
>That is what I was thinking. I think there may be about 8 locations that I
can find and change them. I just didn't know if it would change anything
when going from Integer to Long. Didn't want to find any 'gotchas' for
something that seems so simple.
Salad has hit the high points.

That said I'd recommend doing a find through *ALL* your code looking for Integer.
Not just in the places you think might be a problem. Chances are you can change them
all the longs. You don't want to suddenly find out that one particular chunk of VBA
code has wrapped around and is now updating record ID 1, 2 or 3. Or something
similar.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
Aug 28 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: jaYPee | last post by:
I have a table in my sqlserver 2000 that has a field IDNO. i want this field to be my primary key. however i don't want this field to use the autoincrement feature. when i access this table from...
0
by: Marko Maehner | last post by:
Hi, I have a strange problem with my xml file. In the schema of this xml file I have set one column to autoincrement. When I enter the data in my xml file directly, the autoincrement-column gets...
0
by: Fabio Negri Cicotti | last post by:
I have created into the SQL Server 2 tables parent/child having the parent an autoincrement primary key. E.g.: Order table ordID - tinyint ordName - string(50) Order_Detail table ordID -...
0
by: Neil | last post by:
Hi, I'm getting some strange results using the autoincrement column on my datatable. I'm populating a datatable with data from my database and displaying this in a datagrid. The first time I get...
6
by: Dennis | last post by:
I have set a DataTable and one of the columns I set "AutoIncrement" to True. I then populate the Table by setting the columns to values then add the row to the table. I inadverently set the...
6
by: Michael | last post by:
I am trying to create an access database within Net 2003 using the ADOX library which works fine except when I try to add the AutoIncrement property to the ContactId column. I am experiencing a...
5
by: JC Voon | last post by:
Hi: How to reset the autoincrement value generated by DataTable ? I've master and detail table, the detail table has a autoincrement column, each time i add a new master record, i need to...
3
by: MP | last post by:
context: vb6/ ado / .mdb format / jet 4.0 (not using Access - ADO only) - creating tables via ADO (don't have access) - all tables have a primary key (PK) - many of the PK will become FK(Foreign...
1
rizwan6feb
by: rizwan6feb | last post by:
I have a DataTable with thousands of records, i want to show these records on per page basis ( i.e a DataGridView showing first 20 records and next button to show next 20 records ...) To achieve...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.