?
Solved

Recordset

Posted on 2003-02-24
3
Medium Priority
?
226 Views
Last Modified: 2010-04-17
Beginner:
In Vb code,
how do you automatically add one number to the last recordset of Visdata.
I have:
Dim ID as integer
adolist.recordset.addnew
ID = lastID + 1
0
Comment
Question by:lxguz
[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
3 Comments
 
LVL 9

Accepted Solution

by:
bhagyesht earned 200 total points
ID: 8014196
fire a query as "select max(ID)+1 from <tableName>"
get the value and use the value in your code

Dim RS as RecordSet
Set RS=Con.execute("select max(ID)+1 from myTableName")
If RS.EOF then
  mynewID=1
else
  RS.moveFirst
  mynewID=RS(0).value
End if

then use myNewID

Second option is use a autonumber field
0
 

Expert Comment

by:CleanupPing
ID: 9447530
lxguz:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Introduction to Processes

762 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