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

Copy data to another query

P: n/a
Are there anyway to copy rows of records from one query to another
query and then hide the records in source query ? Pls advise. Thanks.

Regards,
Daniel
Nov 12 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Create a query that joins the two queries and set the appropriate criteria and
you have essentially copied records from one query to another.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com

"Daniel Tan" <da*******@time.net.my> wrote in message
news:6a**************************@posting.google.c om...
Are there anyway to copy rows of records from one query to another
query and then hide the records in source query ? Pls advise. Thanks.

Regards,
Daniel

Nov 12 '05 #2

P: n/a
Records don't live in queries, they live in tables. Queries are just a view
of selected records. So the way to change which of the two queries displays
those records is to change whatever value it is that determines which query
displays the records.

For example, if you have two queries, one of which displays records WHERE
SomeField = 'X' and the other displays records WHERE SomeField = 'Y', then
you change the query that displays a particular record by changing the value
of SomeField in that record from 'X' to 'Y'.

--
Brendan Reynolds

"Daniel Tan" <da*******@time.net.my> wrote in message
news:6a**************************@posting.google.c om...
Are there anyway to copy rows of records from one query to another
query and then hide the records in source query ? Pls advise. Thanks.

Regards,
Daniel

Nov 12 '05 #3

P: n/a
Brendan, do you mean just swap the value of Somefield from one query
to another after i create a new query that comprise of the 2 sub
queries ?

Regards,
Daniel

"Brendan Reynolds" <br******@removethisindigo.ie> wrote in message news:<BG*****************@news.indigo.ie>...
Records don't live in queries, they live in tables. Queries are just a view
of selected records. So the way to change which of the two queries displays
those records is to change whatever value it is that determines which query
displays the records.

For example, if you have two queries, one of which displays records WHERE
SomeField = 'X' and the other displays records WHERE SomeField = 'Y', then
you change the query that displays a particular record by changing the value
of SomeField in that record from 'X' to 'Y'.

--
Brendan Reynolds

"Daniel Tan" <da*******@time.net.my> wrote in message
news:6a**************************@posting.google.c om...
Are there anyway to copy rows of records from one query to another
query and then hide the records in source query ? Pls advise. Thanks.

Regards,
Daniel

Nov 12 '05 #4

P: n/a
No. You can not swap a value from one query to another, because a query does
not contain any values.

To change which records are displayed in a query, you have two choices - you
can change the data (which lives in the table, not in the query), so that it
meets the criteria of a different query, or you can change the SQL statement
that defines the query. Following on from my previous example, if QueryA
displays all records WHERE SomeField = 'X', while QueryB displays all
records WHERE SomeField = 'Y', and I want to change that around, I could do
it as follows ...

Dim db As DAO.Database
Dim qdf As DAO.QueryDef

Set db = CurrentDb
Set qdf = db.QueryDefs("QueryA")
qdf.SQL = "SELECT * FROM SomeTable WHERE SomeField = 'Y'"
Set qdf = db.QueryDefs("QueryB")
qdf.SQL = "SELECT * FROM SomeTable WHERE SomeField = 'X'"

I might be able to offer a clearer explanation if I had more information -
are we really talking about displaying queries directly, or are we talking
about data displayed in form controls, such as combo boxes or list boxes,
based on those queries? This would, in my experience, by a much more common
requirement - filter one combo box or list box based on the item selected in
another, or allow a user to choose items from one list box and display those
choices in another. Is that what we're talking about here?

--
Brendan Reynolds
"Daniel Tan" <da*******@time.net.my> wrote in message
news:6a**************************@posting.google.c om...
Brendan, do you mean just swap the value of Somefield from one query
to another after i create a new query that comprise of the 2 sub
queries ?

Regards,
Daniel

"Brendan Reynolds" <br******@removethisindigo.ie> wrote in message

news:<BG*****************@news.indigo.ie>...
Records don't live in queries, they live in tables. Queries are just a view of selected records. So the way to change which of the two queries displays those records is to change whatever value it is that determines which query displays the records.

For example, if you have two queries, one of which displays records WHERE SomeField = 'X' and the other displays records WHERE SomeField = 'Y', then you change the query that displays a particular record by changing the value of SomeField in that record from 'X' to 'Y'.

--
Brendan Reynolds

"Daniel Tan" <da*******@time.net.my> wrote in message
news:6a**************************@posting.google.c om...
Are there anyway to copy rows of records from one query to another
query and then hide the records in source query ? Pls advise. Thanks.

Regards,
Daniel

Nov 12 '05 #5

P: n/a
HI Brendan

Yes i would like to display my data on a form. I would like if i
click on a check box then the record would be copied to another table
and source record would disappeared.

Regards,
Daniel
"Brendan Reynolds" <br******@removethisindigo.ie> wrote in message news:<TL*****************@news.indigo.ie>...
No. You can not swap a value from one query to another, because a query does
not contain any values.

To change which records are displayed in a query, you have two choices - you
can change the data (which lives in the table, not in the query), so that it
meets the criteria of a different query, or you can change the SQL statement
that defines the query. Following on from my previous example, if QueryA
displays all records WHERE SomeField = 'X', while QueryB displays all
records WHERE SomeField = 'Y', and I want to change that around, I could do
it as follows ...

Dim db As DAO.Database
Dim qdf As DAO.QueryDef

Set db = CurrentDb
Set qdf = db.QueryDefs("QueryA")
qdf.SQL = "SELECT * FROM SomeTable WHERE SomeField = 'Y'"
Set qdf = db.QueryDefs("QueryB")
qdf.SQL = "SELECT * FROM SomeTable WHERE SomeField = 'X'"

I might be able to offer a clearer explanation if I had more information -
are we really talking about displaying queries directly, or are we talking
about data displayed in form controls, such as combo boxes or list boxes,
based on those queries? This would, in my experience, by a much more common
requirement - filter one combo box or list box based on the item selected in
another, or allow a user to choose items from one list box and display those
choices in another. Is that what we're talking about here?

--
Brendan Reynolds
"Daniel Tan" <da*******@time.net.my> wrote in message
news:6a**************************@posting.google.c om...
Brendan, do you mean just swap the value of Somefield from one query
to another after i create a new query that comprise of the 2 sub
queries ?

Regards,
Daniel

"Brendan Reynolds" <br******@removethisindigo.ie> wrote in message

news:<BG*****************@news.indigo.ie>...
Records don't live in queries, they live in tables. Queries are just a view of selected records. So the way to change which of the two queries displays those records is to change whatever value it is that determines which query displays the records.

For example, if you have two queries, one of which displays records WHERE SomeField = 'X' and the other displays records WHERE SomeField = 'Y', then you change the query that displays a particular record by changing the value of SomeField in that record from 'X' to 'Y'.

--
Brendan Reynolds

"Daniel Tan" <da*******@time.net.my> wrote in message
news:6a**************************@posting.google.c om...
> Are there anyway to copy rows of records from one query to another
> query and then hide the records in source query ? Pls advise. Thanks.
>
> Regards,
> Daniel

Nov 12 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.