By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,827 Members | 1,967 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,827 IT Pros & Developers. It's quick & easy.

MS.Access: Copying a single row from one table to another using checkbox

P: 3
I am just learning VBA thru online.. and I couldn't find a solution.

I got these code

CurrentDB.Execute "INSERT INTO Table1 SELECT * FROM Table2 WHERE AppID = " & Me.AppID & ";"

but the problem is all the data in other table will be copied. what I only want is a single row with all the columns will be copied with respect to the checkbox I checked. I am designing that every row has its own respective checkbox.

Jan 3 '19 #1
Share this Question
Share on Google+
7 Replies

Expert Mod 15k+
P: 31,299
Have you tried it? Or are you just guessing? The SQL looks fine to me as far as it goes.

Let's try to get this question expressed properly before we continue. There is an expectation to put some effort into your question before posting it. This is sloppy and shows minimal effort.
Jan 3 '19 #2

P: 3
I think you didn't get what I mean, the code is working but it will copy all data when clicking a checkbox. what i want is a code that will only copy a certain row with respect to the checkbox i checked. by the way im using MS access 2013.
Jan 3 '19 #3

Expert Mod 2.5K+
P: 3,158

Welcome to Bytes!

I think we do get what you mean. However, what NeoPa is referring to and asking for is whether you have actually tried anything in order to get just the one record copied.

You say you are just learning VBA, which is fine--we've all been there. However, your issue has less to do with VBA than it does with SQL (Structured Query Language) which is the language queries are made of. Do you understand how to add criteria clauses to your SQL statements (e.g. "WHERE ...")? This is where it starts.

Aside from that, without knowing anything about your check boxes and forms and everything else, it is impossible for us to guide you through anything further--especially since you have not provided any attempt to resolve the issue yourself--other than simply state that your current query copies all records.

I hope that clarifies.
Jan 3 '19 #4

Expert Mod 15k+
P: 31,299
I think you didn't get what I mean
Absolutely. That was what I was trying to explain to you. Your question was expressed so poorly that no-one could understand what was wrong or help you fix it.

I also asked pertinent questions of course - in order to lead you towards giving helpful information we can actually work with. Unfortunately you seem to have ignored them.

My last comment (of the earier reply) seems to have led to no change in that respect so I'm really not sure what you expect. If you seriously want some help, and are prepared to put in the minimal effort required to explain your problem clearly, in view of what we've already explained is neded, then here's your opportunity. It's a last one as far as I'm concerned.
Jan 4 '19 #5

P: 3
Sorry for the confusion.

Let me elaborate my issue in access; I have 2 TABLES (tb1 & tb2) with multiple FIELDS, while tb1 are filled with data. and I have FORM with checkboxes(cb1, cb2, cb3, etc...). If I check cb1, all fields data from first row of tb1 will be copied to tb2, and cb2 will copied second row and so on... the point is, I only want to select what I need to copy from tb1 to tb2.

I hope it's much clear now. I am not good in access also, I'm just learning piece by piece.

Jan 6 '19 #6

Expert Mod 15k+
P: 31,299
I'm starting to get a picture of what you're trying to do, although what you actually say still doesn't make sense. How can you have multiple CheckBoxes on a form that have different names and that are for different records. I can see there being one per record if you have Continuous Forms set, but otherwise how do you imagine you're going to match the number of records with the number of ComboBoxes?

PS. My first question is still outstanding. That makes two now as there's one in here too now. If we get answers we * May * be able to continue.
Jan 6 '19 #7

P: 1
Thanks for the information.
Jan 7 '19 #8

Post your reply

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