unsigned integer in MS Access

D

Davor

Hello

I am using Access 2002, and a 2000 Compatible DB. I am importing data that
is originaly an unsigned integer (.NET) (this means long in Access) Thing i
would like to do is let access accept unisgned integers, but i don't know
how. Is it even possible?

Converting uInt to signed is not realy an option as I have to sum all the
imported data regulary.

Greets
Davor
 
A

Allen Browne

No. Access does not support the unsigned integer.

If this is a 2-byte (the Access meaning of the word integer), you could
store the data in a Long.
 
B

Brendan Reynolds

Which unsigned integer are we talking about? .NET has UInt16, UInt32, and
UInt64. A UInt16 has a maximum value of 65535, and will fit happily in a Jet
Integer field. A UInt32 has a maximum value of 4294967295, and will require
Single, Double, Decimal or Currency. A UInt64 has a maximum value of
18446744073709551615, and will require Single or Double, with possible loss
of precision. If you don't need to perform any numeric operations on the
data, you could store it in a text field.
 
D

Davor

Hello

pitty, it shouldn't have been a big problem to incorporate it, I guess, as
this is not a uncommon issue.

As i already said, it's a long in access. (32-bit)

What i could use is decimal with 10 digits, but then the DB grows much in
space, and the computation is slower.

Greets
Davor
 
B

Brendan Reynolds

I'm sorry that my attempt to help displeased you, Davor, but don't worry -
you may be quite sure that it will not happen again. Have a nice life.
 
A

AL FINK

Access may not have what you want but you can do as Brendan Reynolds mession
and store your data in a text field then create a function to change your
text data into numeric. This nffect gives you the abilliy to have any number
type and size you want
you could use the function in a query to convert back and forth. It is just
a thought.
 
D

Davor

Al Fink,

I have tu sum the data via queries. Putting numbers in textformat and
'summing' this way more than 1 milion fields would take alot of time, no?

Greets
Davor
 
B

Brendan Reynolds

Note that I only suggested the use of text if numeric operations were not
being performed on the data, Al. If numeric operations are being performed,
the text would have to be converted back into a numeric data type, which
would re-introduce the problem. However, this won't be an issue if the
original data is UInt16 or UInt32, as either of those will fit happily into
Jet Currency or Decimal fields. There's really only a problem if the
original data is UInt64. For example, the following C# code will run without
error, but will fail if the two references to 'UInt32' are replaced with
'UInt64' ...

using System;
using System.Data;
using System.Data.OleDb;
namespace ConsoleApplication20
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;"
+ "Data Source=c:\\dsdata\\db1.mdb;"
+ "Persist Security Info=False";
OleDbConnection connection = new OleDbConnection(connectionString);
try
{
connection.Open();
OleDbCommand command = new OleDbCommand();
command.Connection = connection;
string commandString = "CREATE TABLE Table1 (DecCol DECIMAL)";
command.CommandText = commandString;
command.ExecuteNonQuery();
UInt32 data;
data = UInt32.MaxValue;
commandString = "INSERT INTO Table1 (DecCol) VALUES ("
+ data.ToString() + ")";
command.CommandText = commandString;
Console.WriteLine(command.ExecuteNonQuery().ToString());
Console.ReadLine();
}
finally
{
if (connection != null)
if (connection.State != ConnectionState.Closed)
connection.Close();
}
}
}
}
 
A

Albert D.Kallal

Davor said:
Al Fink,

I have tu sum the data via queries. Putting numbers in textformat and
'summing' this way more than 1 milion fields would take alot of time, no?

The issue here is the max size of the data being imported.

The only issue I can see here is overflow. Assuming you got a unsinged value
of 32 bits.

a 32 bit signed integer has a range of:

-2,147,483,648 to 2,147,483,647

If it is un-signed, then we got

0 to 4294967294

The above number will fit into a currency value no problem at all. (a
currency is a 19 digit long integer, with a scale of 4).

If you read Brendan's response (in place of unzipping your pants), you would
see that he suggest currency as a possible solution.

I suggest you re-read his post, and then explain to me why you can not use a
currency data type?
 
C

Chris Mills

In defence of Brendan, he's one of the most respected Access MVP Ace's around,
IMHO.

I see the problem as this, that posters can vary between beginners and experts
for all we know, most often beginners. Therefore, one has to put up with a bit
of explanation "below one's station", so-to-speak. "Davor", it is clear now,
wasn't born yesterday, who knows when "Davor" was born?

Now I'm really worried about something. Should that be "defense"?

HTH. Make digs and keep it professional (I say to myself...)
Chris :)

in message
 
D

Davor

Well, Albert, the same for you as for Brendan. If you took the time to read
the post (in place, 'as you say it', unzipping your pants) you would have
seen that I already had a solution to Allen Browne's reply. Btw, also the
only person who truly gave a simple answer to my original question, thx for
that!.

Thanx for informing me also that it's an overflow issue, and the size of the
integers, and where they will fit into. I haven't figguered it out untill
now.

Btw, i don't have currencies in access, only doubles, decimals and singes as
an option to Longintegers...

I wonder ... if we could put 'most' of the numbers in a double field... why
'invent' bytes, short's andso on ... 'kugh' 'kugh'

If i seem a bit sarcastic, i will explain it in an other post, above.

Greets
Davor
 
D

Davor

In defence of Brendan, he's one of the most respected Access MVP Ace's
around,

I didn't mean to disrecpect him :), i only get the 'creaps' of people who
don't read the post but write donw off subject about things they know about
the subject that are closely related.

I will just quote here one reply from a person that had a sortlike answer,
then you will maybe understand....:
--------------------------------------------------
I came to this, via a google search because my legit CD has slowly become
scratched, dirty, and unusable. I came here searching the answer to change
the key from one version to another or just to swap a few files and create a
new CD.
It is frustrating when you turn to a forum hoping to gain knowledge ... type
out your question and eagerly open that page from time to time, and then you
finally get a reply .... and they asked "why?"
Guaranteed, after the "why", suddenly they just have to tell a story of how
they know something on a different topic.
Thankfully, cut and paste makes asking the question again easier, on the
same or a different forum because when a reply is given the thread is as good
as closed.

Off I go .... still looking for the answer.
 
C

Chris Mills

I didn't mean to disrecpect him :)

All programmers will do much better if they learned how to spell.
i only get the 'creaps' of people who

There is no need to get the "creeps" about Brendan Reynolds. He has, to my
knowledge over many years, been nothing other than "trying to assist".

I think Brendan was just "expanding" the subject of integers. Certainly, on
first reading, you clearly stated what integer you were posting about, and no
criticism of you. Nor of pointing that out to Brendan. I just saw the thread
as rapidly going downhill, as your spelling clearly identifies...
I will just quote here one reply from a person that had a sortlike answer,
then you will maybe understand....:
--------------------------------------------------
I came to this, via a google search because my legit CD has slowly become
scratched, dirty, and unusable. I came here searching the answer to change
the key from one version to another or just to swap a few files and create a
new CD.
It is frustrating when you turn to a forum hoping to gain knowledge ... type
out your question and eagerly open that page from time to time, and then you
finally get a reply .... and they asked "why?"
Guaranteed, after the "why", suddenly they just have to tell a story of how
they know something on a different topic.
Thankfully, cut and paste makes asking the question again easier, on the
same or a different forum because when a reply is given the thread is as good
as closed.

Off I go .... still looking for the answer.

I actually took the trouble to read all that. One interpretation of Brendan's
reply, was that he took the trouble to explain various integers, whether
necessary, relevant, or not. It is as well to remember that all responders are
"unpaid consultants at otherwise $100/hr", so you are very priviledged to get
such answers for free. If you are earning professional fees, then by merely
asking such a basic question you might ask whether your charged fees don't fal
l into the "charlatan" or "quack" class.
---------------------------------------------------------------------------- -

Greets
Davor

Greetings (in English) I thought a greet was a type of goose, or was that
grouse?
Chris
 
D

Davor

All programmers will do much better if they learned how to spell.

Yes, true. Maybe i reread my code, but i certainly don't reread my posts,
anc certainly if they are totaly off topic, sry.
I just saw the thread as rapidly going downhill, as your spelling clearly identifies...

I didn't knew you judge the knowledge of people by their spelling in posts.
I am sorry if i have dissapointed. Next to my 2 mother languages, croatian
and dutch, english comes after french. Oh, and there is german too :(.
I actually took the trouble to read all that. One interpretation of Brendan's
reply, was that he took the trouble to explain various integers, whether
necessary, relevant, or not. It is as well to remember that all responders are
"unpaid consultants at otherwise $100/hr", so you are very priviledged to get
such answers for free. If you are earning professional fees, then by merely
asking such a basic question you might ask whether your charged fees don't fal
l into the "charlatan" or "quack" class.

This has nothing to do with how much I get charged, lol, and all this is
just speculation. If you must know: I am a full time philosophy/physics
student, and my hobby is informatics. And no, I don't feel piviledged because
i don't care who he is, what he does, how much he is payed; i only want his
knowledge if he want's to share it. This is not the only forum, and I rather
see it as a community, where people help each other, no matter their 'status'.
And if you ask yourself about my fees, then i could (which i don't) ask
myself, about 'experts' helping out 'beginners like me with stupid questons',
this: Why you do it for free, not even a 'charlatan' fee?

The reason i came back to this post after Allen's reaply was because i felt
some of you experts may know a way to incorporate it in Access. All i got was
lessons on integers...
Greetings (in English) I thought a greet was a type of goose, or was that
grouse?
Chris

Greet is a salutation, not a goose, atleast according to my dictionary, no?

For a moment, once Chris, i considered you a serious person.

As this topic is totaly going off subject, you will not see me here anymore,
still, if you have anything to say, i will read your post, as i feel obliged
to.

Greets
Davor
 
C

Chris Mills

I didn't knew you judge the knowledge of people by their spelling in posts.

You mean "know" in that sentence (assuming English). You don't seem to know
tenses, let alone spelling.
It is one indicator of their education, most certainly.
More important than qualifications, I would say.
If they can't spell, how the hell do programmers write code which requires
exemplary spelling, bar nothing, for instance? If I was an employer (which
fortunately I'm not) I would reject outright your application. Are you
claiming you write exemplary grammar in code (thereby avoiding error messages)
and not in posts or other verbal intercourse? How therefore, can we be assured
you know what an integer means?
I am sorry if i have dissapointed.

You have. Never mind, I realise it's only one indicator. Just try to do better
is all I ask.
Next to my 2 mother languages, croatian
and dutch, english comes after french. Oh, and there is german too :(.
Well, that's a very good reason. I salute you. I never heard of someone having
"TWO MOTHER LANGUAGES", which I imagine would require two mothers...:)
I've heard of confusion over fathers, but never mothers :))))))
just speculation. If you must know: I am a full time philosophy/physics
student, and my hobby is informatics.

It's possible (though I don't know) that Brendan was just speculating that you
needed a further understanding of integers. Otherwise you would not have
needed to ask the question.

It was reasonably obvious (as I already intimated) that you were not a
professional programmer like Brendon.

I couldn't care less who Brendan is. I just know that he's "cosher" and
genuinely tries to help. Maybe he's wrong sometimes for all I know. That's all
I can say with regard to the level of this thread, is that I don't like
arguing with Brendan's knowledge.

Your post ("correction") wasn't really that bad, if we assume English isn't
your Mother Tongue, and I myself tend to be abrupt and not "waste words".

Chris
 
B

Brendan Reynolds

I'd really rather forget this whole thread at this stage, but in the
interest of accuracy, and to avoid possible confusion to others who may read
this thread here or in the archives, I feel compelled to reiterate that ...

a) In .NET there are three different unsigned integer data types, with
different maximum values
b) None of the three are equivalent to a Jet or VBA long integer
c) Two of the three will fit comfortably into a Jet currency or decimal
field, one will not

The issue of which unsigned integer Davor is using is, therefore, directly
relevant to the problem. As far as I can see, the only part of my original
post that was not directly relevant to Davor's problem was the final
sentence about using text, as Davor is performing a numeric operation on the
data. If there is anything else in my original post that is not directly
relevant to Davor's problem and its solution, perhaps someone would be kind
enough to explain to me what it is?
 
C

Chris Mills

Well, Davor, here we meet again!
"Albert D.Kallal" is also a well-known Access MVP and most likely trying to
assist you. I don't know him either from a "bar of salt", apart from his many
sensible posts over time.

You are a self-described "student". It is good to ask searching questions.

Einstein was a Jew with German, then Swiss, then American citizenship. Von
Neuman was Hungarian before becoming American. Von Braun, well the Apollo
missiles would have fallen on London rather than the Moon if he hadn't
improved his aim :) Alan Turing was homosexual, but who cares he helped
invent the computer as we know it. John Nash went stark raving mad, but AFTER
some mathematical revelations in "Game Theory" for which he eventually won a
"Nobel" Economics Prize ("A Beautiful Mind", the book).

So it is quite right, as a student as you stated, for you to question all the
acknowledged experts. I would myself, if I had the same balls.

Chris
PS You really should take a class in English Spelling. It looks like ignorance
or slackness, maybe just a bad keyboard, but I don't now think ou are. I mean,
you are.

PPS If you're so smart, please tell us the answer rather than posting a
question. We are all eager learners too...I mean that.
 
D

Davor

Brendan,

I already said i will not reply to this thread, because the answer is
already given (Allen), and hereby give Chris the last word (*relief*), i
still feel i owe something to you.

(I assume you have already read all the posts here :))
I am using Access 2002, and a 2000 Compatible DB. I am importing data that
is originaly an unsigned integer (.NET) (this means long in Access)

This seems to be missleading. What i ment with 'this means long in access'
was the bitwidth 32, as later clarified to Allen. The fact that it's
impossible to get this in access as unsigned 'long' is the whole issue of the
thread. Unsigned/singned ... it's the same to me, just that one signature bit
is the problem which causes the max/min values to differ. I understand that
this 'same to mee' isn't 'same to everyone', herefor my apology.
Thing i would like to do is let access accept unisgned integers, but i don't know
how. Is it even possible?

The answer is already given by Allen: It's impossible. He seemed to
understand what i wanted and gave a clear answer. Next post I get while
writing a reply to Allen is yours, giving a whole explanation on unisgned
integers, what i felt, in some way relevant to my question, but no solution.
It just seemed you wrote things 'you knew' and 'numbers jou looked up or
knew', what a bit irritated me.

Putting byte values in an integer data field, or single values in double
field I don't really feel comfortable with. Certainly not if only one bit is
a bottleneck. All this is not really a solution, but rather a way round at
expense of space/resources, and maybe computing time.

From an expert, Brendan, i would rather have an answer to my reply
(question) to Allen, which is/was:
pitty, it shouldn't have been a big problem to incorporate it, I guess, as
this is not a uncommon issue.

No hard feelings heh ;)

Greets
Davor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top