473,938 Members | 11,711 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

moving record from one table to another

Thanks in advance... I need to on a subform in datasheet view to be
able to, instead of delete a record, move that record to another
table. I can if needed turn the subform into a continuous form
emulating a datasheet view. Any clues on how to do this? Thanks! ...
Dav

Feb 15 '07 #1
1 2560
On Feb 14, 10:54 pm, "Parasyke" <kress1963no... @yahoo.comwrote :
Thanks in advance... I need to on a subform in datasheet view to be
able to, instead of delete a record, move that record to another
table. I can if needed turn the subform into a continuous form
emulating a datasheet view. Any clues on how to do this? Thanks! ...
Dav

Unless there is a program logic reason to do so, I prefer to mark
records as deleted instead of actually deleting them.
You can filter the subform to show records that are not 'deleted' and
they can be retained for history.
Other wise what you need to do is create your own Delete shortcut menu
item or command button and disable deletion of records in the subform
(so that people don't use the actual delete functions). Add something
like the following to a click event of whatever delete button you use
(maybe include a confirmation msgbox).

On Error GoTo stoprun
Dim sql1 As String
Dim sql2 As String
Dim dbs As Database
Dim wrk As Workspace

Set dbs = CurrentDb
Set wrk = DBEngine.Worksp aces(0)

sql1 = "INSERT INTO ...[rest of query] WHERE...somefie ld=" & Me!
subform.Form![criteria field] & "));"
sql2 = "DELETE ...[rest of query] WHERE...somefie ld=" & Me!
subform.Form![criteria field] & "));"

wrk.BeginTrans 'Start transaction in case one of these fails
dbs.Execute sql1, dbFailOnError
dbs.Execute sql2, dbFailOnError
wrk.CommitTrans
Me!subform.Form .Requery

exit_here:
Set wrk = Nothing
Set dbs = Nothing
Exit Sub

stoprun:
MsgBox Err.Number & " - " & Err.Description
wrk.Rollback
Resume exit_here

Feb 15 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1688
by: Todd D. Levy | last post by:
I am moving 3 fields & associated data from 1 table to another. I will have to make the necessary changes to forms, code, queries, & reports, etc. It is the reports, and the queries that they are based on that most concern me. Can I simply edit the existing queries to reflect the new locations of the fields in question, but otherwise leave the queries as is?
2
13623
by: Wayne Aprato | last post by:
I've read most, if not all, of the posts on moving average and still can't find a simple solution to my problem (if a simple solution exists!) I have a table with 2 fields: Hours and Injuries. I have a query based on this table which shows these 2 fields and calculates a third field: Frequency Rate, based on a formula which uses the Hours and Injuries fields. Is there a simple way of A: using yet another calculated field in the query...
2
4423
by: John E. Fox | last post by:
Dear All, What is the best way to move the current record from one table to another? Or copy the current record, then delete it. Thanks John Fox
15
1673
by: Deano | last post by:
I've posted about this subject before but haven't really got anywhere yet. I have now come up with a plan of action that takes into account my strong desire to implement save/discard functionality on all key forms. The first thing to do is to successfully split the database. I then rewrite to support multiple users. To allow the save/discard feature I create copies of the key tables and append the word Final to each one. For example I...
12
12996
by: swingingming | last post by:
Hi, in the NorthWind sample database, when clicking on the next navigation button on the new order record with nothing on the subform (order details), we got an order with nothing ordered. How can we prevent this from happening? Thanks. ming
1
1951
by: maiami2 | last post by:
Hi Guys, I'm very new to access and I've been trying to get the hang of it over the last few days, but I've become very confused with various aspects of how to code it. Introduction: I am using 3 tables for my data base at the moment. The first table is an ID table, which tracks IDs that are in use/taken. The second table is a queue, which has very little/limited information on a person. The third table is a log, which has much more...
1
2487
by: =?Utf-8?B?UmljaA==?= | last post by:
In a database search application (vb2005), the user wants to be able to scroll through records using the mousewheel. The data display form contains textboxes for the main data and a datagridview for the detail data for each main record. The form also contains btnBegining, btnPrevious, btnNext, btnEnd. In the btnNext.MouseWheel event I can increment/decrement the main data currencymanager position of the main dataset (depending on...
5
5373
by: mtgrizzly52 | last post by:
I am running an access 2003 dbase that has been slowly developed for use on a network. (I know, should be sql, but our IT dept won't allow that to happen, so we are stuck) Anyway, because of the extreme turtle's pace of inputting data online, and some other issues concerning liability issues, we have two versions of the same database. The one that is online, and then a version that can be used in the field. Like I said, these two versions are...
3
2451
prn
by: prn | last post by:
Hi folks, I've got something that's driving me crazy here. If you don't want to read a long explanation, this is not the post for you. My problematic Access app is a DB for keeping track of software test data. Each instance of a test is associated with a "test case", that is, a test item. Each test instance (or "run") may have a number of other characteristics too, such as browser used, OS (XP, Vista, Linux, Mac OSX, etc.), etc., but for...
0
10134
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9963
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11524
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
11288
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9857
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8218
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6075
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6295
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4446
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.