Solved

Adding data to a Pocket PC access database ?

Posted on 2004-08-16
4
168 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
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

825 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