473,387 Members | 3,787 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.

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

2
First of all I want to say Hi to every one. So.. Hi :)

I'm new in Access, so please be patient. I've got this problem:
I have a subform, where user can see results from one table called A. There is a checkbox in one of the columns in this table.
What I want to do is to copy the specific row, after user will check the checkbox, as a new row to another table called B. But I don't want to make exact copy, but only values from three columns from A into three columns (with different names) in column B.

Thanks for help.
Sep 20 '06 #1
5 6724
I'm trying to do the same thing. I have writer's block.
Sep 20 '06 #2
I am looking for something very simular, have one person helping me, but I am the newest of newbs to VBA and access. If it is ok I would like to monitor this thread as well as mine.
Sep 20 '06 #3
MMcCarthy
14,534 Expert Mod 8TB
Open the subform in design view.

Go to the checkbox control. Right click on it and go to the events tab.

Go down to the After Update Event and click the little black arrow and select [Event Procedure] then click on the little button with dots beside it.

The VB Editior will open with the following:

Private Sub CheckBoxName_AfterUpdate()

End Sub

In between these two lines put the following:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub CheckBoxName_AfterUpdate()
  3. Dim strSQL As String
  4.  
  5.   strSQL = "INSERT INTO TableB (FieldB1, FieldB2, FieldB3) " & _
  6.                 "SELECT " & Me.Field1 & " As Expr1, " & Me.Field2 & _
  7.                 " As Expr2, " & Me.Field3 & " As Expr3;"
  8.  
  9.   CurrentDb.Execute strSQL, dbFailOnError
  10.  
  11. End Sub
  12.  
  13.  
Sep 21 '06 #4
Blazej
2
Thank You. This is exactly what I need.

Open the subform in design view.

Go to the checkbox control. Right click on it and go to the events tab.

Go down to the After Update Event and click the little black arrow and select [Event Procedure] then click on the little button with dots beside it.

The VB Editior will open with the following:

Private Sub CheckBoxName_AfterUpdate()

End Sub

In between these two lines put the following:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub CheckBoxName_AfterUpdate()
  3. Dim strSQL As String
  4.  
  5.   strSQL = "INSERT INTO TableB (FieldB1, FieldB2, FieldB3) " & _
  6.                 "SELECT " & Me.Field1 & " As Expr1, " & Me.Field2 & _
  7.                 " As Expr2, " & Me.Field3 & " As Expr3;"
  8.  
  9.   CurrentDb.Execute strSQL, dbFailOnError
  10.  
  11. End Sub
  12.  
  13.  
Sep 22 '06 #5
Here's what I need to do:

User enters data on formA and subformA. One field on subformA is a check box. If checkbox is checked need to copy some fields for each of those records to FormB, SubformB, when user clicks button. Both forms use the same tables.

I'm am sure these are several ways to accomplish this; but still having writer's block.

Any help would be appreciated.

Thanks,

Janice
Sep 25 '06 #6

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

Similar topics

0
by: claudel | last post by:
Hi I have a newb PHP/Javascript question regarding checkbox processing I'm not sure which area it falls into so I crossposted to comp.lang.php and comp.lang.javascript. I'm trying to...
4
by: Jack | last post by:
Hi, I have a checkbox the value which goes to a database via a asp page that builds the sql string. In the front end asp page, the checkbox code is written as follows: <i><input...
0
by: Keith | last post by:
I have a repeater control that contains a HeaderTemplate and an ItemTemplate. Each item contains a checkbox with an ID of chkReconciled, and the header contains a single checkbox with an ID of...
0
by: Keith | last post by:
I have a repeater control that contains a HeaderTemplate and an ItemTemplate. Each item contains a checkbox with an ID of chkReconciled, and the header contains a single checkbox with an ID of...
9
by: mike7510uk | last post by:
Hi, I am using a gridview with a templatefield containing a checkbox. I want to update the database with a 1 or 0 depending on if a checkbox is checked or unchecked (then use the 1 or 0 later on...
0
by: cyberdawg999 | last post by:
Greetings all in ASP land I have overcome one obstacle that took me 2 weeks to overcome and I did it!!!!! I am so elated!! thank you to all who invested their time and energy towards helping me...
4
by: Charlotte | last post by:
Hi, I have a problem with a ASP-script, can somewone help me ? here is what I've got: mypage.asp : .... code ... <%
8
by: ALTAFAD | last post by:
How to copy selected (s) textfield, which those selected through checkbox I like to copy in clipboard. Access textfield data when front of the textfield checkbox is checked if not checked it...
1
by: janetb | last post by:
I have a gridview with an update capabilities - a textbox column (roomName), a dropdownlist(orgID), a dropdownlist(roomTypeID),a checkbox column (dialOut), a checkbox column (dialIn). When I try to...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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.