424,066 Members | 2,123 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,066 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.

Thanks!
2 Weeks Ago #1
Share this Question
Share on Google+
7 Replies


NeoPa
Expert Mod 15k+
P: 31,170
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.
2 Weeks Ago #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.
2 Weeks Ago #3

twinnyfo
Expert Mod 2.5K+
P: 2,780
jems,

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.
2 Weeks Ago #4

NeoPa
Expert Mod 15k+
P: 31,170
Jems:
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.
2 Weeks Ago #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.

Thanks!
2 Weeks Ago #6

NeoPa
Expert Mod 15k+
P: 31,170
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.
2 Weeks Ago #7

P: 1
Thanks for the information.
2 Weeks Ago #8

Post your reply

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