Queries :: Query Selects Records Twice

Aug 22, 2013

why this query pulls every record twice and what I can do to fix it?I did it in design mode because I'm an amateur, but here is the SQL.

SELECT [Patient Data Table].[First Name], [Patient Data Table].[Last Name], [Patient Data Table].[C MRI Facility], [Patient Data Table].[C MRI Sched Date], [Patient Data Table].[C MRI Scan Done]
FROM [Patient Data Table], [Date Range]
WHERE ((([Patient Data Table].[C MRI Scan Done])=Yes) AND ((Month([C MRI Sched Date]))=[Date Range]![From Month]) AND ((Year([C MRI Sched Date]))=[Date Range]![From Year]));

View Replies


ADVERTISEMENT

Queries :: Selects Active Records For Three Different Selections - Concatenate Query Results

Nov 3, 2014

I have a query that selects the "Active" records for three different selections, A, B or C.. There may be 1, 2 or 3 results for a particular selection. That is Selection A may have one result or active records, but Selection B may have three results.

I want to use data from the query to populate a field on a form. For example, if the results for Selection A, having one "Active" record would be RecordAData. But for Selection B with three "Active" records the result would be RecordBData & " " & RecordBData2 & " " & RecordBData3

My query is:
SELECT tblSomething.ID, tblSomething.D1, tblSomething.D2, tblSomething.D3, tblSomething.D4, tblSomething.D5, tblSomething.D6, [D3] & " " & [D4] & " " & [D5] & "-" & [D6] & " " & "SomeText" AS Header
FROM tblSomething
WHERE (((tblSomething.D1)=Forms!frmSomethingHeaders!D1) And ((tblSomething.D2)=True));

The concatenation in the query is labeled "Header". I want to be able to Concatenate the "Header" which in itself is a concatenation in the query.

I thought that this might be a looping through the query results, but I cannot figure out how to do it. But then, that is only my uneducated guess.

View 11 Replies View Related

Queries :: How To Write A Query Which Selects Multiple Records From A Table At Once For Updating

Aug 14, 2013

I have a list box whose data is inserted in a table named as "test0" ,now in a macro of vba i want to select all the items in the list box and create there pdf files in a folder at my desired location. So far i have managed to create a pdf file of single item ,but i want to select multiple items at once ,

Code:
SELECT test0.ID, test0.item FROM test0 WHERE (((test0.item)=[ItemNumber]));

So, in this query itemNumber are multiple and i want to create there pdf files at once ..just on a click of one button ?

View 2 Replies View Related

Query Selects No Records, How To Convert Null To Zero

Apr 29, 2008

Simple query, but I need to roll the results up with others and a null return is hurting me. I have been chasing my tail around with the nz(), input masks, IIF statements, only to prove my ignorance and possible insanity for expecting different results.

Here we go:

SELECT Count([LDB LOG].DSTHTL) AS ["tot120"]
FROM [LDB LOG]
WHERE ((([LDB LOG].[LDB Rcvd]) Between Now()-120 And #1/1/2008#))
GROUP BY [LDB LOG].[T-7 Date]
HAVING ((([LDB LOG].[T-7 Date]) Is Null));

This is being used to count open items into age buckets, the above is the greater than 120 days (discounting anything prior to 2008). If the T-7 Date is null the item is open. What is happening is that no records are being selected, resulting in the null value back.

Any help would be greatly appreciated as I have spent an unrealistic amount of time on this.


Thanks
Brendan

View 6 Replies View Related

Multiple Selects And Records Store

Dec 21, 2005

I'm creating an Access data entry form for computer installations.

Basically the entry form will choose a software and license, then select one or more computers to install the software on.

Then later we can create a report that can track what softwares are installed on the computers, or track what computers has what softwares.

Now my question is for each record of the installation entry form, after we select the software, then we will choose a computer name or more computer names.
If just one computer is easy, but how can I choose multiple computers, which control should I use? and how can I store the computer name list in the installation table, do I have to make each computer installation a record in the table or put multiple computer names in one record in the field like memo, but if I use memo, later it seems i cannot group or search memo field?

Can anyone give me some ideas about what is an easy design solution or samples about these?

Thanks a lot

View 1 Replies View Related

Query Which Selects Fields?

Mar 17, 2007

Is it possible to create a query which selects selects fields in a table, not just data in a field? If so, how?

TIA

View 1 Replies View Related

Multiple Selects In An Access Passthru Query

Sep 7, 2005

Hi,

I'm trying to run a pass thru query into a sybase server from Access. The query contains multiple selects which Access doesn't appear to like very much. The query works fine when run in Sybase.

Is there any way of circumventing this problem?

I could split the three selects into three seperate queries to view the individual results but the third set is dependant on the previous two sets and so therefore is difficult (impossible?) to seperate out as a third individual query.

Thanks for any suggestions?

Select
s.id_prtf Portfolio_ID,
s.id_imnt Instrument_ID,
s.id_imnt_swap Instrument_Swap_ID,
s.id_ccy_std Currency,
s.am_posn Position,
s.am_pnl_eqty PNL_Eqty

into #temptable1
from
SET_VALUATION s, INSTRUMENT i
where
s.id_imnt = i.id_imnt
and s.id_posn_ref is NULL
and s.id_imnt_swap is NULL
and s.am_pnl_eqty > 0
and i.id_typ_imnt != 'SFX'

Select
s.id_prtf Portfolio_ID,
s.id_imnt Instrument_ID,
s.id_imnt_swap Instrument_Swap_ID,
s.id_ccy_std Currency,
s.am_posn Position,
s.pr_imnt_mtm_prev,
sy.pr_imnt_mtm,
s.am_mv_prev,
sy.am_mv

into #temptable1a
from SET_VALUATION s, SET_VALUATION_HIST sy, REFERENCE_DATA r
where
s.id_prtf = sy.id_prtf
and s.id_imnt = sy.id_imnt
and s.pr_imnt_mtm_prev != sy.pr_imnt_mtm
and s.am_mv_prev != sy.am_mv
and r.dt_bus_lst = sy.dt_bus

select
t.*,
tt.pr_imnt_mtm_prev,
tt.pr_imnt_mtm,
tt.am_mv_prev,
tt.am_mv

into #newtemp
from #temptable1 t, #temptable1a tt
where
t.Portfolio_ID = tt.Portfolio_ID

delete from #temptable1
where #temptable1.Portfolio_ID in (select Portfolio_ID from #newtemp)
delete from #temptable1a
where #temptable1a.Portfolio_ID in (select Portfolio_ID from #newtemp)

select "Where id_posn_ref is NULL and id_imnt_swap is NULL is the only criteria"
select * from #temptable1
select "Where SET VAL's pr_imnt_mtm_prev does not equal SET VAL HIST's pr_imnt_mtm, is the only criteria"
select * from #temptable1a
select "Where the output satisfies both Where id_posn_ref is NULL and id_imnt_swap is NULL AND Where SET VAL's pr_imnt_mtm_prev does not equal SET VAL HIST's pr_imnt_mtm"
select * from #newtemp

drop table #temptable1
drop table #temptable1a
drop table #newtemp

View 2 Replies View Related

Deleting Selects Field

Oct 7, 2005

I have this code that works fine exept for one thing. If I have two names that are the same it deletes them both.
currentdb.execute "insert into charmer91 (last,first) values ('"me.list0 & "','" & me.list0.column(1) & "')"
currentdb.execute "delete table1 (last, first) from table1 where last ='"&list0 &"'"
How can I change the delete statement so it only deletes the selected name I have in list0, ie.. the highlighted one?
Basically Im moving data from one table to another via listboxes.

thanks in advance

View 3 Replies View Related

Combo Box Which Selects From One Table Out Of Many?

Aug 9, 2014

So instead of having all of my data on a single table which is filtered out as I make selections in my initial 3 combo boxes, I'd like for each set of data to be on it's own table. Instead of filtering out the irrelevant data in a single table, I'd like the initial 3 combo boxes to instead filter out the irrelevant tables. My main reasoning for doing this is that I figure it would first off save me much trouble in the future when editing data within the tables and also that one huge data table would slow down Access eventually.

View 9 Replies View Related

Using IIF Criteria To Choose Between Two Different Like Selects

Aug 26, 2014

I am setting up an Access database for a small school. The database contains a record per person. When we get a duplicate lastname field we set a family_id field to lastname followed by a number.

So for example the first Smith family needs to family_id. But the second Smith family gets a family_id of smith1. To select an ordered list of Families I need a query that will use the family_id if it is set and if not use the the lastname to collect family members.

My query uses a presorted table, CurStuByGrdTbl , of current students to produce the families directory by grade and alphabetized.

The WellSchoolCommunityAll table is the entire database. So if the student entry has a valid family_id, matching pattern "*#" then

I perform a Like with family.id otherwise I perform a Like with lastname.

This query gets me nothing, no records.

IIf(([CurStuByGrdTbl].[family_id]="*#"),[CurStuByGrdTbl].[family_id] Like [WellSchoolCommunityAll].[family_id],[CurStuByGrdTbl].[lastname] Like [WellSchoolCommunityAll].[lastname])

View 4 Replies View Related

ListBox Selects Row When Scroll Bar Is Clicked

Oct 31, 2006

I'm using Access 2002 and when I try to scroll up or down it selects the row and then scrolls 1 row. Is this a bug?

thanks
Paul

View 1 Replies View Related

Queries :: When One Sub Query Has No Records Entire Main Query Is Blank

Oct 1, 2014

I have a query with three sub queries, all returning a number from different tables. But when any one of the sub queries returns a blank, the entire main query is blank.

How do I stop this from happening? I have tried NZ() on the sub queries and on the main query, but the blank still happens.

View 1 Replies View Related

Access Selects All Field Text When Typing

Oct 30, 2012

I have created a database.On opening the [Company] form opens up.After pressing the 'Add new company' button it creates a new record. when typing immediately into the 'Company Name' field, access highlights all the text whilst your typing making you delete what you have just typed.I have tried several macros and vba at various different events to try and solve including 'Gotocontrol', 'refesh'. I have even tried SelStart.

View 1 Replies View Related

Modules & VBA :: If User Selects Wrong Value / Display Message

Feb 23, 2015

I have a field that is pre filled in with a value. The name is "Business".Then there is a combo box with various values. If the user would select a value that does not match with values that can be selected if in "business" a value is selected, it should show a message that the selection is wrong and user needs to select the correct one.

Example:If in the field "Business" the value "Food" is selected, then the possible values to be selected in the combobox would be: Fruit or Meet or Fast Food. If the value in "Business" would be "Wood" only selections could be made: Talble or Chair or Cabinet.So, if a user select "Food' in "Business" and in the combo box "Chair", it should show a message that the wrong selection was made and don't let them use the wrong one.

View 11 Replies View Related

Forms :: Button That Opens Form And Pre-selects A Value In List Box

Aug 24, 2014

I open a form (EntryBasic) for users to enter data in, which is then saved to the only table in the database (MasterTable). The form (EntryBasic) has a list box with four choices: red, white, blue, orange. The button that opens the form is placed on another form (MainForm) The form (EntryBasic) record source is MasterTable.

A user is on the MainForm and needs to add a new record related to red. When user clicks on the button (NewRedEntry), I need the form to open and the list box pre-selected to red.

Is there a macro or VBA code that might simply execute this action, preferably something that can be attached to the NewRedEntry button?Even better, if there are two list boxes, code such code be applied to same NewRedEntry button, where both list box values are pre-selcted with the click of this button?

View 5 Replies View Related

Track Order In Which User Selects Items From A List

May 11, 2012

I am trying to find out if there is a way to track the order in which items are selected from a list. I am a dabbler and any keyword searches that I can think of don't bring up what I am looking. So, here is what I am trying to do:

I have a table of symptoms with 3 fields (ID, Category, and Symptom).I have a combo box that will allows the user to pick a category (using select Distinct on category field). I then have a list box populated with all the symptoms that have a category of whatever the user selected. The problem I am having is that I need to somehow track the order in which the user selects symptoms and then save that order for future reference and to be printed on a report. The order is important because the most severe symptom needs to be listed first.

View 7 Replies View Related

Queries :: Query That Will Return Records From A Table That Have Related Records In Another Table

Mar 4, 2015

I am looking for a query that will return records from a table that have related records in another table. Opposite to the Unmatched Query Wizard.I have two tables: tblSupplier and tblSupplierProducts.The two tables are related by the field "SupplierId".I need the query to only return Suppliers that have Products.

View 3 Replies View Related

Queries :: Getting Rid Of Records In A Query

Oct 7, 2013

I have a report that is producing duplicates.

In my query I determine one of the fields using nested conditional statements

e.g. iif(component =1 and fred = "z", component, iff(component = 2 and fred ="x", "stuff"), "xxxxx")

(this may not be syntactically correct but bottom line I want to stick xxxx in field if conditions are not met and if that is the case I don't a) want that record in the query or b) I don't want to print the record in the report.

I have tried using the criteria in the query (<> "xxxx") but still get the record. Not looked at seeing if I can remove it from the report somehow.

View 4 Replies View Related

Queries :: Counting Records From More Than One Query

Aug 14, 2015

I'm running into an issue where I'm trying to tie several queries together into a list one running total. I have six queries that pull data from the same table, but that meet specific criteria. What I was trying to accomplish was to have a 7th query count the records in each of the six queries, and return the results as a different value for each. Here's an example:

Queries:
qry_1A
qry_1B
qry_2A
qry_2B
qry_3A
qry_3B

Final product:
qry_totals:
1A | 1B | 2A | 2B | 3A | 3B |
20 | 15 | 33 | 19 | 12 | 6 |

What I tried:
Field: 1ATotal: Count([qry_1A].[valueName])
Total: Expression

And I did this for each field that I wanted the query to return, so:
Field: 1BTotal: Count([qry_1B].[valueName])
Field: 2ATotal: Count([qry_2A].[valueName])
Field: 1BTotal: Count([qry_2B].[valueName])
Field: 3ATotal: Count([qry_3A].[valueName])
Field: 3BTotal: Count([qry_3B].[valueName])

The problem is that I don't get what I expected - the query appears to be totaling all the records counted and applying that value to all the fields, so I get this:

1A | 1B | 2A | 2B | 3A | 3B |
105|105 |105 |105 |105 |105 |

View 2 Replies View Related

Queries :: Query Records With Same Value In A Field

Aug 17, 2015

I have made a database to catalogue my coin collection, I have a table with various fields for logging data about each coin.I want to try and make a query that can easily filter the coins that I have the same year so I can easily see which sets of coins I have in each year, without having to type in each year.

So basically I want the query to detect that I have a 3 pence, 2 pence and shilling all dated 1887 and crown and half crown dated 1945 etc.

View 1 Replies View Related

Queries :: Need A Query To Find Records That Contains No

May 29, 2015

I have a table 45 fields. There is a field ID. I would like to get the records where fields contains "No". I would not like to create 45 queries for each field check. how can i generate a table which shows ID, Field Name that contains value "No".

View 4 Replies View Related

Queries :: Counting Records In Query?

May 10, 2013

I have constructed a neat database for randomly quizzing myself on French translations. However I need a simple way of counting the records in an underlying query "vocabularyQ" inside a sub routine. I have tried all sorts of statements the most recent being

SELECT Count(VocabularyQ.ID) AS CountOfID FROM VocabularyQ

View 5 Replies View Related

Queries :: Only Show Records That Do Not Appear In Another Query

Jul 30, 2013

Currently I have a query, QRY_Test which contains a load of records under the fields "Gift_ID" and "Person_ID". I have another query, QRY_PersonList in which I would like to show all of the "Person_ID"s except the ones returned by QRY_Test.

View 3 Replies View Related

Queries :: If Within Query - Display All Records

Sep 22, 2014

in my query i have multiple tables, one table just has one field called product thats joined to another table the other table displays a list of all products, if the product is in the other table.i want a "X" to display in that field both columns are text the IF im using is,

IIf([Product] Is Null,"","X")

but when i run this, it displays no records what so ever, if i take out that iff, it displays all records i want, but that field is the product number when i need an X

View 4 Replies View Related

Queries :: Append Query - Only New Records

Aug 15, 2013

How can I modify the below code so that it only adds new records to AttributesTBL from ProductInformation-Consumer?

INSERT INTO AttributesTBL ( Material )
SELECT [ProductInformation-Consumer].Material
FROM AttributesTBL INNER JOIN [ProductInformation-Consumer] ON AttributesTBL.Material = [ProductInformation-Consumer].Material;

View 2 Replies View Related

Queries :: Summing Records In A Query?

Jul 24, 2013

I have a query which displays sales and cash deposits for the day. I want a sum of all cash deposits.

So it looks like this..

Date________________Amount_______________SumOfAmou nt____________Exp1
17/7/2013___________$55___________________$55__________ __________$55
17/7/2013___________$22___________________$22__________ __________$22

I tried doing it by two methods.. neither of which are working.

In the Amount field, I put it as a Total: Sum. I also tried creating a new field which is an expression which sums up the Amount field. Neither are summing it and just displays the value.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved