?
Solved

Adding data to a Pocket PC access database ?

Posted on 2004-08-16
4
Medium Priority
?
193 Views
Last Modified: 2010-05-02
I have a database installed on my pocket PC, and am am trying to write a small apllication for data collection.

As you know that you can't have a "ID" field in a Pocket Databse which generates it's own random number, so you have to insert a random number yourself.

I have this code which generates a 10 digit random number:

        Dim NewID As Long
        Dim Cntr As Integer
   
        Randomize
   
        For Cntr = 1 To 10
            NewID = NewID & Int(Rnd * 10)
        Next

But when I try to enter it into the table:

        rs.AddNew
        rs.Fields("ID") = NewID
        rs.Update

I get a error saying "A literal value in the command overflowed the range of the type of the associated column"

The data type of the ID column in table is a Long Integer as it should be. I have tried to convert the NewID variable in to a Long Interger via CLng(NewID) but it still throws the same error.

Any ideas ?
0
Comment
Question by:markh51
4 Comments
 
LVL 26

Accepted Solution

by:
EDDYKT earned 200 total points
ID: 11808926
Try to use 9 digits instead

max long is 4294967295
0
 
LVL 5

Expert Comment

by:amit1978
ID: 11809409
Hello,

I hope u r working in eVB for Pocket pc application, but in pockect PC there is only one datatype varient. which is sub divided into different data formats.

0
 
LVL 48

Expert Comment

by:Mikal613
ID: 11809579
If its a AutoNumber or Identity you cant set the number
0
 

Author Comment

by:markh51
ID: 11810000
EDDYKT:

Thanks for that, it works fine now.

Quick simple answer just how I like it ;)

Cheers.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question