Solved

Adding data to a Pocket PC access database ?

Posted on 2004-08-16
4
161 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 50 total points
Comment Utility
Try to use 9 digits instead

max long is 4294967295
0
 
LVL 5

Expert Comment

by:amit1978
Comment Utility
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
Comment Utility
If its a AutoNumber or Identity you cant set the number
0
 

Author Comment

by:markh51
Comment Utility
EDDYKT:

Thanks for that, it works fine now.

Quick simple answer just how I like it ;)

Cheers.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now