Solved

Transfer One Record into New Table and Delete in Old Table

Posted on 2006-11-15
3
142 Views
Last Modified: 2010-04-30


I need the Access form and when you click the"YES" I need to have the one RECORD to transfer the reocrd into a different table and Delete in the present table. Just the Record you are on.  Is this possible?
'//////////////////////////////////////
Private Sub cmdTransferToTable1_Click()
Dim iResponse As Integer

  iResponse = MsgBox("Are You Sure?", vbYesNoCancel, "Processing")

  Select Case iResponse
 
    Case vbYes

'//////////////////

Any help would greatly be appreciate!!


0
Comment
Question by:ca1358
[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
  • 2
3 Comments
 
LVL 65

Accepted Solution

by:
Jim Horn earned 500 total points
ID: 17950659
First, run an append query that adds the record from the 'present table' into the 'different table'.
Second, run a delete query that deletes the record from the 'present table'.

Better, bundle both actions into a transaction such that they both succeed or fail together.

{using ado}

Dim cn as adodb.connection
Set cn = 'Need more info here.

With cn
  .BeginTrans
 
  .Execute "INSERT INTO tblDifferent (foo) SELECT blah FROM tblPresent WHERE ID=" & SomeID
  .Execute "DELETE FROM tblPresent WHERE ID=" & SomeID

  If err.number=0 then
    .CommitTrans
  Else
    .RollbackTrans
  End IF
End With
0
 

Author Comment

by:ca1358
ID: 17958615
Thank you!
0
 
LVL 65

Expert Comment

by:Jim Horn
ID: 17958669
Thanks for the grade.  Good luck with your project.  -Jim
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one 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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

751 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