Solved

Adding data to a Pocket PC access database ?

Posted on 2004-08-16
4
173 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

734 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