Different queries but the same?

Hi Everyone,

Access 2003.  I accidently double clicked on the wrong thing in a new query 
based on another query.  In the query grid, I added the 
qryVentThpyWithinLastArea and double clicked on the *.  It only filled one 
column of my grid but when I ran the query, it showed all the fields from 
the query.  I then dragged down Area field and added my criteria.  I had 
been taught to double click on the blue title bar and then drag all the 
fields to the grid then add my criteria.  Both ways give me the same data. 
What is the differnce?

I pasted the sql below so you can see what's going on...

SELECT qryVentThpyWithinLastArea.*, qryVentThpyWithinLastArea.AreaName
FROM qryVentThpyWithinLastArea
WHERE (((qryVentThpyWithinLastArea.AreaName)="PICU"));


SELECT qryVentThpyWithinLastArea.PtLName, qryVentThpyWithinLastArea.PtID, 
qryVentThpyWithinLastArea.AdmitDtTm, qryVentThpyWithinLastArea.DCDtTm, 
qryVentThpyWithinLastArea.AdmitNum, qryVentThpyWithinLastArea.PtThpyID, 
qryVentThpyWithinLastArea.AreaName, qryVentThpyWithinLastArea.TherapyTypeID, 
qryVentThpyWithinLastArea.TherapyDesc, qryVentThpyWithinLastArea.ThpyStDtTm, 
qryVentThpyWithinLastArea.ThpyEndDtTm, qryVentThpyWithinLastArea.AdmLOS, 
qryVentThpyWithinLastArea.VentLOS
FROM qryVentThpyWithinLastArea
WHERE (((qryVentThpyWithinLastArea.AreaName)="picu"));

Thanks,
Linda 


0
Linda
9/22/2007 2:22:01 PM
access.queries 6343 articles. 1 followers. Follow

3 Replies
583 Views

Similar Articles

[PageSpeed] 38

> I had
> been taught to double click on the blue title bar and then drag all the
> fields to the grid then add my criteria.

well, that's a quick way for beginners. there are many instances where you
don't need *every* field in a table to be included in a query; in those
cases, you should select only the fields you *do* need - one by one - from
the table's fieldlist in the query design grid.

when you do need all table fields in the query, either method you described
is okay. be aware, though, that when you use the asterisk (*) to call all
the fields, and then add a specific field *again* so as to enter criteria on
that field, you're going to get that field TWICE in the query output - the
second time with an automatically generated fieldname, usually "Expr1". the
solution in this scenario is the uncheck the checkbox in the field you've
explicitly added for criteria purposes, so it doesn't show up twice.

hth


"Linda RQ" <RomulanQueen@OnDuty.sttng> wrote in message
news:eGaGyPS$HHA.4476@TK2MSFTNGP06.phx.gbl...
> Hi Everyone,
>
> Access 2003.  I accidently double clicked on the wrong thing in a new
query
> based on another query.  In the query grid, I added the
> qryVentThpyWithinLastArea and double clicked on the *.  It only filled one
> column of my grid but when I ran the query, it showed all the fields from
> the query.  I then dragged down Area field and added my criteria.  I had
> been taught to double click on the blue title bar and then drag all the
> fields to the grid then add my criteria.  Both ways give me the same data.
> What is the differnce?
>
> I pasted the sql below so you can see what's going on...
>
> SELECT qryVentThpyWithinLastArea.*, qryVentThpyWithinLastArea.AreaName
> FROM qryVentThpyWithinLastArea
> WHERE (((qryVentThpyWithinLastArea.AreaName)="PICU"));
>
>
> SELECT qryVentThpyWithinLastArea.PtLName, qryVentThpyWithinLastArea.PtID,
> qryVentThpyWithinLastArea.AdmitDtTm, qryVentThpyWithinLastArea.DCDtTm,
> qryVentThpyWithinLastArea.AdmitNum, qryVentThpyWithinLastArea.PtThpyID,
> qryVentThpyWithinLastArea.AreaName,
qryVentThpyWithinLastArea.TherapyTypeID,
> qryVentThpyWithinLastArea.TherapyDesc,
qryVentThpyWithinLastArea.ThpyStDtTm,
> qryVentThpyWithinLastArea.ThpyEndDtTm, qryVentThpyWithinLastArea.AdmLOS,
> qryVentThpyWithinLastArea.VentLOS
> FROM qryVentThpyWithinLastArea
> WHERE (((qryVentThpyWithinLastArea.AreaName)="picu"));
>
> Thanks,
> Linda
>
>


0
tina
9/22/2007 2:34:26 PM
Thanks

Linda

"tina" <nospam@address.com> wrote in message 
news:SJ9Ji.122447$ax1.87834@bgtnsc05-news.ops.worldnet.att.net...
>> I had
>> been taught to double click on the blue title bar and then drag all the
>> fields to the grid then add my criteria.
>
> well, that's a quick way for beginners. there are many instances where you
> don't need *every* field in a table to be included in a query; in those
> cases, you should select only the fields you *do* need - one by one - from
> the table's fieldlist in the query design grid.
>
> when you do need all table fields in the query, either method you 
> described
> is okay. be aware, though, that when you use the asterisk (*) to call all
> the fields, and then add a specific field *again* so as to enter criteria 
> on
> that field, you're going to get that field TWICE in the query output - the
> second time with an automatically generated fieldname, usually "Expr1". 
> the
> solution in this scenario is the uncheck the checkbox in the field you've
> explicitly added for criteria purposes, so it doesn't show up twice.
>
> hth
>
>
> "Linda RQ" <RomulanQueen@OnDuty.sttng> wrote in message
> news:eGaGyPS$HHA.4476@TK2MSFTNGP06.phx.gbl...
>> Hi Everyone,
>>
>> Access 2003.  I accidently double clicked on the wrong thing in a new
> query
>> based on another query.  In the query grid, I added the
>> qryVentThpyWithinLastArea and double clicked on the *.  It only filled 
>> one
>> column of my grid but when I ran the query, it showed all the fields from
>> the query.  I then dragged down Area field and added my criteria.  I had
>> been taught to double click on the blue title bar and then drag all the
>> fields to the grid then add my criteria.  Both ways give me the same 
>> data.
>> What is the differnce?
>>
>> I pasted the sql below so you can see what's going on...
>>
>> SELECT qryVentThpyWithinLastArea.*, qryVentThpyWithinLastArea.AreaName
>> FROM qryVentThpyWithinLastArea
>> WHERE (((qryVentThpyWithinLastArea.AreaName)="PICU"));
>>
>>
>> SELECT qryVentThpyWithinLastArea.PtLName, qryVentThpyWithinLastArea.PtID,
>> qryVentThpyWithinLastArea.AdmitDtTm, qryVentThpyWithinLastArea.DCDtTm,
>> qryVentThpyWithinLastArea.AdmitNum, qryVentThpyWithinLastArea.PtThpyID,
>> qryVentThpyWithinLastArea.AreaName,
> qryVentThpyWithinLastArea.TherapyTypeID,
>> qryVentThpyWithinLastArea.TherapyDesc,
> qryVentThpyWithinLastArea.ThpyStDtTm,
>> qryVentThpyWithinLastArea.ThpyEndDtTm, qryVentThpyWithinLastArea.AdmLOS,
>> qryVentThpyWithinLastArea.VentLOS
>> FROM qryVentThpyWithinLastArea
>> WHERE (((qryVentThpyWithinLastArea.AreaName)="picu"));
>>
>> Thanks,
>> Linda
>>
>>
>
> 


0
Linda
9/22/2007 3:21:36 PM
you're welcome  :)


"Linda RQ" <RomulanQueen@OnDuty.sttng> wrote in message
news:%23Nh1ExS$HHA.5328@TK2MSFTNGP05.phx.gbl...
> Thanks
>
> Linda
>
> "tina" <nospam@address.com> wrote in message
> news:SJ9Ji.122447$ax1.87834@bgtnsc05-news.ops.worldnet.att.net...
> >> I had
> >> been taught to double click on the blue title bar and then drag all the
> >> fields to the grid then add my criteria.
> >
> > well, that's a quick way for beginners. there are many instances where
you
> > don't need *every* field in a table to be included in a query; in those
> > cases, you should select only the fields you *do* need - one by one -
from
> > the table's fieldlist in the query design grid.
> >
> > when you do need all table fields in the query, either method you
> > described
> > is okay. be aware, though, that when you use the asterisk (*) to call
all
> > the fields, and then add a specific field *again* so as to enter
criteria
> > on
> > that field, you're going to get that field TWICE in the query output -
the
> > second time with an automatically generated fieldname, usually "Expr1".
> > the
> > solution in this scenario is the uncheck the checkbox in the field
you've
> > explicitly added for criteria purposes, so it doesn't show up twice.
> >
> > hth
> >
> >
> > "Linda RQ" <RomulanQueen@OnDuty.sttng> wrote in message
> > news:eGaGyPS$HHA.4476@TK2MSFTNGP06.phx.gbl...
> >> Hi Everyone,
> >>
> >> Access 2003.  I accidently double clicked on the wrong thing in a new
> > query
> >> based on another query.  In the query grid, I added the
> >> qryVentThpyWithinLastArea and double clicked on the *.  It only filled
> >> one
> >> column of my grid but when I ran the query, it showed all the fields
from
> >> the query.  I then dragged down Area field and added my criteria.  I
had
> >> been taught to double click on the blue title bar and then drag all the
> >> fields to the grid then add my criteria.  Both ways give me the same
> >> data.
> >> What is the differnce?
> >>
> >> I pasted the sql below so you can see what's going on...
> >>
> >> SELECT qryVentThpyWithinLastArea.*, qryVentThpyWithinLastArea.AreaName
> >> FROM qryVentThpyWithinLastArea
> >> WHERE (((qryVentThpyWithinLastArea.AreaName)="PICU"));
> >>
> >>
> >> SELECT qryVentThpyWithinLastArea.PtLName,
qryVentThpyWithinLastArea.PtID,
> >> qryVentThpyWithinLastArea.AdmitDtTm, qryVentThpyWithinLastArea.DCDtTm,
> >> qryVentThpyWithinLastArea.AdmitNum, qryVentThpyWithinLastArea.PtThpyID,
> >> qryVentThpyWithinLastArea.AreaName,
> > qryVentThpyWithinLastArea.TherapyTypeID,
> >> qryVentThpyWithinLastArea.TherapyDesc,
> > qryVentThpyWithinLastArea.ThpyStDtTm,
> >> qryVentThpyWithinLastArea.ThpyEndDtTm,
qryVentThpyWithinLastArea.AdmLOS,
> >> qryVentThpyWithinLastArea.VentLOS
> >> FROM qryVentThpyWithinLastArea
> >> WHERE (((qryVentThpyWithinLastArea.AreaName)="picu"));
> >>
> >> Thanks,
> >> Linda
> >>
> >>
> >
> >
>
>


0
tina
9/22/2007 9:33:49 PM
Reply:

Similar Artilces:

EXCEL and Query
Microsoft Query won't give me access to data in a Microsoft Excel list. After connecting to the data source (another EXCEL spreadsheet) the error message 'No tables visible' is displayed. I have named the source spreadsheet as described in the on- line help, but still no result. Is there something else I need to switch-on? Help please. Have you tried giving a name to the table in the source spreadsheet. Eg. Data is in A1:F2500 - highlight that area and go Insert / Name / Define.... call it MyData - that table name should become visible when you do the query from the ot...

automatically assign value to query
Hello, Ive got a database where staff login just using their name, and the login button has a macro assigned as follows Condition : Not IsNull([cboCurrentEmployee]) Action : SetTempVar Arguments : CurrentUserID, [cboCurrentEmployee] Certain contacts in my database are assigned to a member of staff and call sheets are set up using a query that requests that member of staffs name. Is there a way of automatically setting the criteria of the query to only show clients that are assigned to the member of staff that has logged in? Thanks, please let me know if i need to explain th...

Exchange Server 2003: Can I set a public folder or information store up on different server?
Hi I was wondering if it is possible to set up a second information store for public folders onto a separate server. The primary information store would reside on server 1 with its private and public edb file but i would like a second public accessible edb file set up on a second server distinct from the exchange server. Thanks in advance for any help. Marco You mean a Public Folder server? Yes, you can. If your PF traffic/performance requirements justify it, as they do in some organizations, you can setup a setup a separate server and host Public Folders on it. -- Bharat Suneja MVP -...

Update query only partially working
Hi I'm trying to run an update query but for some reason it's only updating some of the records. The weird thing is that the field that i'm coparting to update is an auto number. I've checked both tables and the fields seem to be the the same and the records present in both so i'm stuck as to what is wrong. I'm using access 2007 to edit an access 2000 DB. Thanks On Thu, 26 Nov 2009 03:47:07 -0800 (PST), "d3cyph3r@gmail.com" <d3cyph3r@gmail.com> wrote: >Hi I'm trying to run an update query but for some reason it's only >up...

Lookup for oldest date among different dates
Hi all, I badly need your help in the below formula Example: Structure : Account includes Sub-accounts and each sub-account includes dials Formula : Account activation date = Oldest Sub-account activation date where there is more than one account and hence different activation date for each account and in turn the sub-accounts that belong to each account Below the example A B C D Account # Sub-Account # Account Sub-account activation activation ...

Combining queries 02-22-08
I want to update a column with a update query, the type of the field is text and I want to change a .(dot) into :. If I run the query I get no result. It should not be that difficult. What am I doing wrong doenka wrote: > I want to update a column with a update query, the type of the field is text > and I want to change a .(dot) into :. If I run the query I get no result. It > should not be that difficult. What am I doing wrong -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Who knows, you haven't shown your query. Have you tried using the Replace() function? UPDATE table...

Collections management Query letters print error
In GP I am getting an error message "A get/change first operation on table 'CN_Printer_settings' has caused an unknown error (469)" when I try to print invoices, statements, and Letters from a Query. Then when I continue I get a message that says, "A save operation on table 'CN_Printing_settings' has filled the disk" Could someone please help me fix this? Thanks, Jon ...

is this possible? reload a form that is based on a query with new query that is defined in the form.
I have a basic form. The form is based on a query, so when I open the form, a pop comes up where I enter in what I want to query. So instead of 30,0000 records, I get 1-10 records. on the form, I have a text box. I want to be able to enter in what I want to query next and afterupdate have the recordset/form reload with that query instead of my original qeury. I figure this has to be done with VB. I am just starting to learn some VB but I am lost. Any info would be great, thank you. It does. You need to apply the new query or table name, or the sql string to the forms recordsource, then...

Complex Query question
I've got a challenging query I need help with! Here's a snapshot of the tables and relationships. I've put the relevant tables into this query layout just for illustrative purposes. ----- click on it to make it bigger (it's still a little hard to read) http://tinypic.com/view.php?pic=6xu9oh4&s=1 Note - the table names start with phrases that are not relevant to this question (ie I use the word "record" for another use than the normal database usage of that word). ------ I'll explain the setup. I want the Table Record-Orders-Sales to lookup Record-Cur...

What is the difference in Find and Look For ?
I don't understand - sometimes I get different results. They are the same. Advanced Find allows you to use additional criteria. -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in 24 Hours Need Help with Common Tasks? http://www.outlook-tips.net/beginner/ Outlook 2007: http://www.slipstick.com/outlook/ol2007/ Outlook Tips by email: dailytips-subscribe-request@lists.outlooktips.net Outlook Tips: http://www.outlook-tips.net/ Outlook & Exchange Solutions Center: http://www.slipstick.com Subscribe to Exchange Messaging Outlook newsletter: EMO-NEWSLETTER-SUBSCRIBE-...

triger or query parent child
Can someone write a query or triger to break all new parent items to child items. On Sep 1, 2:21=A0pm, mastt...@netzero.com wrote: > Can someone write a query or triger to break all new parent items to > child items. I don't think I was clear enough after reading. When i receive a po I want all the parent items broken down to child items and parent item zeroed. On Sep 1, 2:37=A0pm, mastt...@netzero.com wrote: > On Sep 1, 2:21=A0pm, mastt...@netzero.com wrote: > > > Can someone write a query or triger to break all new parent items to > > child items. > > I...

Query Count if Function QQQQssss
I have a range where Attendees of a convention either pre-register, Compted, Pre-register Only, or Register on site. For the on-site regitered they can register on Friday Saturday or Sunday. (that is a Different Range) I want to count "Registered" In the registered Range; From each Day EG Friday, Saturday, Sunday (Date Range) I can countif Dates and Registered but how do I make it count on two different Cryteria Hi Mark! You can use SUMPRODUCT as one approach to counting on more than one criteria: =SUMPRODUCT((WEEKDAY($A$1:$A$24)=1)*($B$1:$B$24="Registered")) -- -- R...

Duplicate query 12-06-07
I have 2 databases which have data, I wish to check one database against the other for duplicate records using a specific number sequence assigned to each record. But this number sequence is not an ID field. I wish to write all non duplicates from this database to a new list? I'm still new to access and don't know how to approach this. -- Paul Wilson The field you join on does not have to be an id field. As long as you wish to identify records in two tables that have the same values in a field (or fields), you just join the two tables on those fields. If there is already a j...

different behavior in Excel2002
I have an empty WB with VBA code in IT in Excel 2002: Sub main() Dim wb As Workbook Set wb = ActiveWorkbook 'wb.SaveAs Filename:="\\nygisw906107\My Documents\test.xls" wb.SaveAs Filename:="c:\Documents and Settings\1igodzin\My Documents\test.xls" 'wb.Save End Sub I am trying to save this WB using wb.Saveas in the same place with the same name. Depending how I Open the WB only one of these lines is working. 1. open using File|Open . in this case second statement is working. 2. open using Start|Run \\nygisw906107\My Documents\test.xls just first statement is workin...

Access Query result different when opened in automation
I have a query that pulls information from three different linked tables. (this might very well be the source of my problems but I dont understand why) When I run the query manually in Access the result set is as I expect, but when I use that query in a function in Access VBA, the where clause is partially ignored. The part that is ignored is here: (ServerDetails.SERVER_TYPE) Not Like "*Domain Controller*") The full filter is here: WHERE (((ServerDetails.ENVIRONMENT)="HOME") AND ((ServerDetails.SERVER_TYPE) Not Like "*Domain Controller*") AND (((ServerDet...

mail merge with different subjects
I have to sent email messages with mail merge with different subjects. I have excel sheet which contains subject, email address fields. please help -- With gratitude, Faisal Ijaz You cannot do it with mail merge out-of-the-box. You could do it with a modification of the code used in the the article "Mail Merge to E-mail with Attachments" at: http://word.mvps.org/FAQs/MailMerge/MergeWithAttachments.htm -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, o...

Append Query to Mainform and Subform
I am using Access 2007. The problem is that my append query for the subform is not updating the online SQL Server table called dbo_Actions_local. The apend query for the main form though is updating the online table called dbo_Contacts. I am not getting any errror messages when I fire the event. First the query for the mainform is fired with a OpenQuery action and then the one for the subform. I have two append quries that are connected to a form, the main form also includes a subform. I will explain the structure of my tables. Local tables: Contacts (PK=ID) Actions_local(PK=...

no recent records query
I need to design a query that will show me customers that have not given me orders after a date. I don't simply want a list of orders before a date... but I want a list of records where the date is prior to a specific date and no records exist for that client after that date. My table includes a [date] field and a [customer] field (among others) and multiple records for the same customer. So assuming a customer stopped giving me business in say May of 2007 I want his name to come up or at least his records to and then I can work with that data. THANK YOU, tp On Jan 10, 6:5...

how would I write this criteria for a query?
I have three fields that I want to base a criteria on: Received Date/Time, Date Approved and Date Rejected The way I wrote the criteria is as follow: LagTime: [Received Date/Time] - [Date Approve] This works if there is a date in the "Date Approve" field but if there isn't a date in the field nothing comes back. What I would like for it to do is pull the date from the "Date Rejected" field and calculate the lagtime from there. What do I need to add to my expression to do this? On 6 Sep, 20:14, Jerry Whittle <JerryWhit...@discussions.microsoft.com> wrote:...

Counting Three Different Words In One Column
H ithere, Can someone please help me? I have a column which can only have option (due to validation), these are:- New Overdue Updated Closed I would like to count the number of times each one has been entered. Each count would be in a different cell on a different worksheet. have tried searching this forum and found answers similar to what i' looking for but i could not get any of them to work for some reason? Thanks very much for your time. Swmasso -- Message posted from http://www.ExcelForum.com Hi you need to use the countif function for this so if your range is ...

Inline comments in Access queries
How to add inline comments to access queries.? On Thu, 21 Jan 2010 21:26:22 -0800, Susanna <Susanna@discussions.microsoft.com> wrote: >How to add inline comments to access queries.? > Alas, you cannot: an annoying restriction of the program! Microsoft has been hearing complaints about it for years but AFAIK has still done nothing to solve it. There are some kludgy getarounds, e.g. SELECT ... <a bunch of stuff>, "Put your descriptive comment here" AS IgnoreThis, ... but it's pretty inadequate. -- John W. Vinson [MVP] ...

BP sales queries
On my sales page for BP 4.0 no data displays for my Customer Payments, customer payrment details,Document list and document list detail. I can see customer list,address and balance. Sometimes I receive the error query error but not all the time. It allows me in the modify these queries. Why do I not have any data. Thanks, Amy Amy, Thanks for using the newsgroups. There could be a few reasons that this is failing. Could it be permissions issues (Does your user have access to the entities)? What errors are you seeing? Thanks Rob -- Rob Bernhardt Software Quali...

Function to Query CSV file
I have a simple csv file with two fields (employee number, employee name). I would like to build a custom function (something like GetEmployeeName), so that when the user enters =GetEmployeeName('12345'), it will query the csv file, look for employee number 12345 and return that employee's name. I have very basic VBA and SQL skills. Basically enough to know this is possible, but not enough to make it happen. Has anyone written anything like this in the past? Appreciate any help. Thanks Jason Check out the basic VLOOKUP() Function in Help -- It will do...

Outgoing email from a different domain sometimes is not delivered
Hi We're running exchange server std 2003 on a windows 2003 std. The server collects mail for 2 domains: domain1.com and domain2.com. Domain1.com is the default email policy, however, some users need to send mail from domain2.com. All seems to be working correctly, i can send emails from both email domains and receive email to both domains. However, some mail sent from domain2.com is not being delivered to certain clients, yet emails from domain1.com will get delivered. I'm guessing their bulk email is stopping it for some reason. Does anyone know why some email gets thro...

Are there any page setup differences between Excel versions
I have created a spreadsheet on Excel 2000 and set up the pages to print correctly. My colleage is using a later version of Excel and is having page setup difficulties with my spreadsheet Your workbook should not be causing difficulties with Page Setup. What page setup difficulties is she having? Is she able to open Page Setup? Use its settings? In article <BF83F39B-9BCD-4313-BF73-1F9CE771AFB9@microsoft.com>, Steveh <Steveh@discussions.microsoft.com> wrote: > I have created a spreadsheet on Excel 2000 and set up the pages to print > correctly. My colleage is using ...