473,387 Members | 1,760 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 2533
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.Workspaces(0)

sql1 = "INSERT INTO ...[rest of query] WHERE...somefield=" & Me!
subform.Form![criteria field] & "));"
sql2 = "DELETE ...[rest of query] WHERE...somefield=" & 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
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...
2
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...
2
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
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...
12
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...
1
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...
1
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...
5
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...
3
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.