473,395 Members | 1,941 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Copy data to another query

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
5 2651
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

42
by: Edward Diener | last post by:
Coming from the C++ world I can not understand the reason why copy constructors are not used in the .NET framework. A copy constructor creates an object from a copy of another object of the same...
1
by: Rhanda Zak | last post by:
Hi all, my question is maybe so trivial, that I even could not find it in Google's NG seach, so I annoy you now: I simply want to copy the result of a SELECT query to another table which has...
0
by: gary b | last post by:
My forehead is sore from beating it against the wall. Can anyone help? I've started drinking again because of this problem! Setup: ContestantTbl = table ('one' side) HorseTbl = table ...
3
by: Melissa Kay Beeline | last post by:
This is driving me crazy!! I'm using MSACCESS, and all I want to do is create a macro/query/anything that will take the data in Column A and copy it into Column B (same table) "Insert into"...
3
by: David Altemir | last post by:
I have a table in MS Access 2003 that contains records that I would like to copy to the end of the table. There is one slight deviation from just doing a straightforwared COPY, however, in that I...
4
by: JIM.H. | last post by:
Hello, I am trying to write the data I got from a web service to my table in SQL Server I need to append the dataset wsDS to the dataset ds and do update. PVS.myWS.Loader load = new...
5
by: Hokiecow | last post by:
I'm trying to import specific columns from an excel file (Requirements.xls) into an access table (tblRequirements). Using VBA, I'm able to import the entire excel file into table...
4
by: colmkav | last post by:
Hi, I need to copy a linked table but without keeping the link. ie all the data and settings accept for the link to another db. How can I do this? Colm
3
by: Richnep | last post by:
Hi all, I have tabbed subforms where I need to copy one field value from one subform over to another subform. Although I can run an update query to accomplish this I would like to do it through...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.