Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Copy Current Record in Visual Basic

Posted on 2006-04-10
6
Medium Priority
?
152 Views
Last Modified: 2013-11-25
I'm using Visual Basic as my front end and Access 2000 as my backend.

I want to add a button to a form that would copy the current record.  It would append it to the existing recordset and then show up as the current record.

I'm updating a project and it was done using DAO and datacontrols for the recordsets.  I have to keep it with DAO.

Any help would be appreciated.
0
Comment
Question by:ecohouse
2 Comments
 
LVL 16

Expert Comment

by:jimbobmcgee
ID: 16420793
You can use GetRows to copy the current row to a variant array and then AddNew that to the recordset.  Something like (untested):

    Dim a_Rows As Variant, nFld As Integer
    a_Rows = oRS.GetRows(1)

    oRS.AddNew
    For nFld = 0 To UBound(a_Rows, 2)
        a_Rows.Fields(nFld).Value = a_Rows(0, nFld)
    Next nFld
    oRS.Update

At least, something like that should work...

J.
0
 

Accepted Solution

by:
GranMod earned 0 total points
ID: 16723468
Closed, 125 points refunded.
GranMod
The Experts Exchange
Community Support Moderator of all Ages
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
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…

578 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