473,320 Members | 2,092 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,320 software developers and data experts.

Numbers in Table

abouddan
Hi all
I am using Access 2000 and I have a table let's call it "Table1".
This table contains many fields and one of them is the primery key called "ID"
Table1 :

ID Desc
1 ...
10 ...
11 ...
2 ...
3 ...


When using this Select statment "Select Max(ID) from table1"
it returns as result "3" and this is not correct.
What to do?
Feb 28 '07 #1
5 1682
MMcCarthy
14,534 Expert Mod 8TB
Hi all
I am using Access 2000 and I have a table let's call it "Table1".
This table contains many fields and one of them is the primery key called "ID"
Table1 :

ID Desc
1 ...
10 ...
11 ...
2 ...
3 ...


When using this Select statment "Select Max(ID) from table1"
it returns as result "3" and this is not correct.
What to do?
Change the datatype of the ID field to a number. Long Integer would be the best option.

Mary
Feb 28 '07 #2
Thanks Mary for your support

I know I can convert the field format to Number but I need them in String format cause I must have a record that contain '-' as primary key, So this fiels must be String.
Mar 1 '07 #3
MMcCarthy
14,534 Expert Mod 8TB
Thanks Mary for your support

I know I can convert the field format to Number but I need them in String format cause I must have a record that contain '-' as primary key, So this fiels must be String.
Then you will need something like ...
Expand|Select|Wrap|Line Numbers
  1. Select Max(CLng([ID])) from table1
This will convert ID to a number before getting the Max of it.

Mary
Mar 1 '07 #4
I will try it

Many thanks
Mar 1 '07 #5
NeoPa
32,556 Expert Mod 16PB
That will probably crash on the "-" record unfortunately.
It seems unwise to try to mix these as you are doing. If absolutely necessary, you can save the numeric values as formatted strings instead. You'd need to select a number of digits that will never be exceeded for it to work.


Expand|Select|Wrap|Line Numbers
  1. ID      Desc
  2. Table1 :
  3. 000001  ...
  4. 000002  ...
  5. 000003  ...
  6. 000010  ...
  7. 000011  ...
Mar 3 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Jason | last post by:
What I am trying to do is get all of the records in a table that are out of sequence so I know which account numbers I can reuse. I have a range of account numbers from 50100 to 70100. I need to...
6
by: Jenn L | last post by:
I have a database that is pre-populated with sequential part numbers. As people reserve the parts I update a flag to show the # is no longer available. Now they want the ability to take out a...
16
by: StenKoll | last post by:
Help needed in order to create a register of stocks in a company. In accordance with local laws I need to give each individual share a number. I have accomplished this by establishing three tables...
6
by: GSpiggle | last post by:
I have a database with records that should have a consecutive number ID (Check Register). Also has other records (deposits and adjusting entries) that don't fit in the number range so...
2
by: Sreya | last post by:
Hello..I hope someone can help me with this little that I've been having for a while. I have a form..which has many fields. one of them being a test #. what I need a combo box with only certain...
1
by: peter_k | last post by:
Hi, I've to implement fast library for big numbers arithmetics. I'll store the number in the table of unsigned long variables. And now i've a question: what will be faster: a) storing in one...
9
by: MLH | last post by:
A mailing list table in its virgin state contained sequential, consecutive integers in an autonumber field (A97). I've deleted records throughout the table. Now I would like to identify each...
3
by: emalcolm_FLA | last post by:
Hello and Thanks in advance for any help. I have been tasked with rewriting a christmas assistance database using Access 2003. The old system used pre-assigned case numbers to identify...
24
by: pereges | last post by:
I need to generate two uniform random numbers between 0 and 1 in C ? How to do it ? I looked into rand function where you need to #define RAND_MAX as 1 but will this rand function give me ...
3
by: jim | last post by:
Does anyone know why the query below would return numbers? I'm attempting to produce a report that shows in *one* column the names that appear in multiple columns in a single table. Table Name:...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.