473,405 Members | 2,338 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,405 software developers and data experts.

Copy one row after checkbox is checked from one table to another

3 2Bits
New to using VBA in MS Access, please be nice.

When the user click's a button, I need the button to move only that row onto an existing table.

Example, something needs to be recycled, user clicks the recycle button and it moves that row of data to a recycle table that holds all the recycled rows.

I've spent 2 days working on this new database for work and this is the last portion that I need to finish, any help would be much appreciated.
Feb 10 '21 #1

✓ answered by isladogs

If the question is aimed at me, I never said it wasn't viable. Its perfectly possible but not a good idea

My point is that its not a sensible approach to remove 'deactjvated' records to a different table
The boolean field Recycle is fine. Default value=false and ticked if records is for 'recycling'

Once ticked, leave the record(s) in the same table.
You should just use a query or sql statement for your form record source to only show records where the field is false.
If you need to view the recycled records instead or indeed all records, this is easily managed using code from option group choices or button click events

7 2917
isladogs
456 Expert Mod 256MB
IMHO, that's not a sensible approach.
You should not need to move data from one table to another.
Instead, if you want to deactivate a record, this is easily done using a boolean (Yes/No) field which could be called Active.
Set the field True by default.
When you want to 'recycle' a record, just set the Active field = False
Feb 10 '21 #2
ADezii
8,834 Expert 8TB
I totally agree with isladogs in that your approach is not a sensible one. That being said, there are some circumstances under which an unorthodox approach is warranted, or dictated by higher ups. If this is True, then a couple of questions to clarify.
  1. On a Form, you wish to click a Recycle Button that will copy the Current Record to a Recycle Table, then DELETE it?
  2. What is the structure of your Main Table (Record Source for the Form), Field wise?
  3. Does the Recycle Table contain the same Fields as your Main Table, and if not, what are the Field alignments between the two?
Feb 11 '21 #3
NeoPa
32,556 Expert Mod 16PB
As has already been hinted at - it seems you're designing simple attributes into separate tables. Newbie? Maybe that needs some explanation.

Databases aren't human and thinking about data should not be done simply as a human would see & understand it. Set theory is what underpins database technology, so it makes sense for your designs to be based on the understanding of sets.

Tables are for similar items - not for different statuses. The status of an item is simply an attribute of that item. It doesn't make it into a different item. In the same way when something is flagged for recycling than a simple Recycle attribute (or Field as we use in databases) in your table designed for that type of item, just changes its value.

You may find a perusal of Database Normalisation and Table Structures to save you a great deal of time later on.
Feb 11 '21 #4
DarkBlue140
3 2Bits
So the recycle field is in fact a boolean, currently it just checks off the box but doesn't remove the record. I was trying to use some VBA on the field so when it's clicked, that row of data would be removed and moved to a different table, but from what you're saying that isn't viable. What would you recommend?
Feb 12 '21 #5
isladogs
456 Expert Mod 256MB
If the question is aimed at me, I never said it wasn't viable. Its perfectly possible but not a good idea

My point is that its not a sensible approach to remove 'deactjvated' records to a different table
The boolean field Recycle is fine. Default value=false and ticked if records is for 'recycling'

Once ticked, leave the record(s) in the same table.
You should just use a query or sql statement for your form record source to only show records where the field is false.
If you need to view the recycled records instead or indeed all records, this is easily managed using code from option group choices or button click events
Feb 12 '21 #6
DarkBlue140
3 2Bits
Ah ok, that makes more sense isladogs, thanks for the feedback from everyone.
Feb 12 '21 #7
isladogs
456 Expert Mod 256MB
Glad to have helped.
One of my biggest mistakes over 20 years ago was moving all student leavers to a separate leavers table and all associated data e.g. Attendance, academic grades, reports etc etc to associated tables. By the time I'd realised my mistake, it would have been far too much work to reverse.

However it meant, from that tome on, I had to ensure all tables maintained the same structure whenever any field were added/modified/deleted together with corresponding queries and code. Over the years, that decision added hundreds if not thousands of hours to development time.

I'm glad to have helped you avoid making a similar mistake.
Feb 12 '21 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Bill | last post by:
I have a table I'd like to copy so I can edit it and play around with the data. How do I create copy of a table in SQl Server? Thanks, Bill
4
by: Visual Systems AB \(Martin Arvidsson\) | last post by:
Hi! How do I convert a CheckBox.Checked to an int? Regards Martin Arvidsson
6
by: AFN | last post by:
I want to click a checkbox and have a 4 line (approx) paragraph appear beneath the checkbox, pushing the rest of the page down. And when unchecking the checkbox, the paragraph should disappear...
1
by: Steve | last post by:
ive been too busy trying to get my database and forms to work to really concern myself with backing things up or protecting the data in case a user really botches something up. is there anything...
2
by: Andrew | last post by:
Hi, I have a problem capturing the checkboxes that are checked, I get false irrespective of wether they are checked or not. I have gone thru the sample code on this forum, but they dun seem to...
8
by: blakerrr | last post by:
Hi All, Is it possible to create a carbon-copy of a table using VBA? I have a table called 'Junction' that stores the structure of a machines assemblies and subassemblies, and I need to create a...
3
by: nologo | last post by:
All, Have a problem i just cant find the answer for. I'm trying to populate a colum in a SQL database. Basically the column requires a 1 or 0. I'm trying to populate this col via a c#...
0
by: AmrutaR | last post by:
How to copy one column into another column using SQL SELECT DISTINCT T1.PROJECT_NAME, T1.REFERENCE_ID, T1.NAME AS URL1_title, T1.URL AS URL1, T1.REQUEST_TYPE, ...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
0
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...

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.