Copying a cell

A

Aaron Daniels

I have a cell in a query called Comp 1 and a second cell called comp 2. I
need to create a button on a form that when pressed copies the copies the
record in Comp 1 to Comp 2. Can someone help me script this. Thanks
 
G

Graham R Seach

Aaron,

You say you want to update a query. You can't update data in a query, only
in the results it returns. What are you ultimately trying to do?

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
A

Aaron Daniels

I am trying to copy data from one cell to another. I'd like to have a button
that copies the data in one cell to another cell
 
G

Graham R Seach

Aaron,

The word "cell" has no meaning in Access; it's an Excel term. Nevertheless,
when you say you want to copy a value from one "cell" to another, what are
you talking about? Are you really saying you want the same value to appear
in two fields in a query, or are you wanting to display this extra "cell" on
a form?

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
J

John Vinson

I have a cell in a query called Comp 1 and a second cell called comp 2. I
need to create a button on a form that when pressed copies the copies the
record in Comp 1 to Comp 2. Can someone help me script this. Thanks

Queries don't have "cells". How are you using this term? Access tables
have Records made up of Fields (or Columns if you prefer). Are you
trying to store a second copy of a record into the table (running the
risk of redundancy), or update one field in a record to the value of
another field in the same record, or what?

John W. Vinson[MVP]
 
J

John Vinson

Okay, I have a column called Comp 1 and a second cell called comp 2. I

It's almost NEVER appropriate to store the same data in two fields,
but assuming you have a good reason to do so nonetheless:

Private Sub cmdCopy_Click()
Me![Comp 1] = Me![Comp 1]
End Sub

assuming the command button is named cmdCopy; just click the ... icon
by its Click property, choose Code Builder, and insert the one line
between the Sub and End Sub lines it gives you.

John W. Vinson[MVP]
 
A

Aaron Daniels

Thanks John, that did the trick!

John Vinson said:
Okay, I have a column called Comp 1 and a second cell called comp 2. I

It's almost NEVER appropriate to store the same data in two fields,
but assuming you have a good reason to do so nonetheless:

Private Sub cmdCopy_Click()
Me![Comp 1] = Me![Comp 1]
End Sub

assuming the command button is named cmdCopy; just click the ... icon
by its Click property, choose Code Builder, and insert the one line
between the Sub and End Sub lines it gives you.

John W. Vinson[MVP]
 
Top