473,796 Members | 2,488 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

2 New Member
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 6753
jmclueless
3 New Member
I'm trying to do the same thing. I have writer's block.
Sep 20 '06 #2
kiask2343
10 New Member
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 Recognized Expert Moderator MVP
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_Af terUpdate()

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 New Member
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_Af terUpdate()

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
jmclueless
3 New Member
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
2133
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 construct a checkbox array in a survey form where one of the choices is "No Preference" which is checked by default. If the victim chooses other than "No Preference", I'd like to uncheck
4
4631
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 type="checkbox" name="chk_Complete" value="<%Response.Write l_IsChecked%>"<%if cbool(l_IsChecked) then Response.Write " checked"%>> The code to captures the checkbox value in the asp page that builds the sql string is follows
0
2810
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 chkAll. I simply want to have chkAll be checked if every item in the repeater has its checkbox checked. In the code behind page, I can access the checked property of chkReconciled by doing the following: Dim CurrentCheckBox As CheckBox...
0
2285
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 chkAll. I simply want to have chkAll be checked if every item in the repeater has its checkbox checked. In the code behind page, I can access the checked property of chkReconciled by doing the following: Dim CurrentCheckBox As CheckBox...
9
5536
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 another page)..i have been google around and found this.... If e.Row.RowType = DataControlRowType.DataRow Then Dim Chk As CheckBox = e.Row.FindControl("CheckBox1") just dont know what to do next...Any ideas?
0
4104
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 with my problems. Now for my new little problem,I had a problem posting the values from checkbox fields to a database and thats the obstacle I overcame. Now the second part is my new problem is that I want that the next time that page loads for...
4
4440
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
6231
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 should not copy in clipboard. If text field has data like that altaf/ahmed mr one field checked goodguydude@thisandthatandtheother.com one field checked...
1
3794
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 add another checkbox column, the sql database isn't updated properly with a 0/1 or false/true but with null. I've tried everything I can think of. Can anyone help? Data command stuff: UpdateCommand="update telehealth.dbo.xTblRoom...
0
9683
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
9529
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
10457
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...
0
10013
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7550
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
5576
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4119
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3733
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2927
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.