Queries :: Query Shows Duplicate

Dec 4, 2014

I hve a query that I want to total soldAtPrice *quantity This information is stored in my order details table and mus not change .I can do a calculated field to get the answer but the Problem is if there are 2 recodrs to be totaled the query displays 2 records if there are 3 records the query dislplays 3 records and so on .I need one record to be displayed with the total of all the recodrs

View Replies


ADVERTISEMENT

Queries :: Query Duplicate / Replacements Are More Than 1

Aug 14, 2013

I have a database which holds information about repairs. Each repair is called a task and among other things data is held about things(s) that caused the failure and what need to be replaced. Usually it's one fault but it could be many.Replacements are usually more than 1. Bottom line, in a simplistic view, I have 3 tables task, fails and replacements. There is one to many relationship between tasks and fails and also a one to many relationship between tasks and replacements.

If there is one fail and many replacements my query is good enough as it will produce

task1 fail1 replace1
task1 fail1 replace2
task1 fail1 replace3

On the report I can hide duplicates to get the desired (. = space!!)

task1 fail1 replace1
...............replace2
...............replace3

Problem occurs when I get more than 1 fail. Query returns

task1 fail1 replace1
task1 fail1 replace2
task1 fail1 replace3
task1 fail2 replace1
task1 fail2 replace2
task1 fail2 replace3

Hiding duplicates I get

task1 fail1 replace1
...............replace2
...............replace3
.........fail2 replace1
...............replace2
...............replace3

whereas I'd like to get

task1 fail1/fail2 replace1
.....................replace2
.....................replace3

or something similar.

View 14 Replies View Related

Queries :: Inserting With Duplicate Key Query

May 19, 2013

I have a load of data in an excel spread sheet that I'm trying to put into an access using Excel VBA (Jet/ACE SQL I think!?). I do this by constructing INSERT INTO strings and looping through my spread sheet. Let's say the primary key is associated with the field [Company] which holds the company names. A simplified version of what I was using (it all works great ) is below:

Code:
Set rs = New ADODB.Recordset
Set cn = New ADODB.Connection
cn.ConnectionString = GetConnectionString()
cn.Open
cn.Execute strSQL

where strSQL =

Code:
INSERT INTO tblTestMDB ([Company], [Date])
VALUES ('BP', '30/09/2012')

Unfortunately, I am having issues with users adding the same company twice. I'd like it to:

- update the existing company info if the company already exists
- add the company if it is not already there.

I'm trying to do it in two stages. First an update, then an add. The first part works great :

Code:
UPDATE tblTestMDB
SET [Date]='21/03/2015'
WHERE [Company]='BP';

The second part: (I have tried numerous variations on the syntax):

Code:
INSERT INTO tblTestMDB ([Company], [Date])
VALUES ('BP', '30/09/2012')
WHERE NOT EXISTS (SELECT * FROM tblTestMDB WHERE [Company] = 'BP');

I find the error messages rather cryptic but they include things like "Query input must contain at least one table or query." or "Missing semicolon ( ; ) at end of SQL statement." (<== No I'm not!?

View 2 Replies View Related

Queries :: Shows Time Slots (4) Available In A Row During Day

Sep 20, 2014

I have a mismatch Query that shows time slots available during day that have not been booked (15 minute intervals) the problem I have i want to just show the time slots that are available depending on what treatment has been chosen so if it was a one hour appointment then it checks that 4 slots available in a row and just displays that

Available
11:00
11:15
12:00
12:15
12:30

How I would try to do this
12:45
13:00
13:15
13:30

so would show for a 1 hour appointment
12:00
12:15
12:30

View 8 Replies View Related

Queries :: Recordset Shows Nothing In The Code?

Aug 21, 2013

i have a combo box ,and when i should select "all",this button after update code should show me all the column of table test ,but looks like for no reason the record set shows nothing and its not working.

Code:

Private Sub cboTaskListName_AfterUpdate()
'On Error GoTo cboTaskListName_AfterUpdate_Err
Me.Refresh
Dim db As DAO.Database
Dim SQL As String
Dim rs As DAO.Recordset
If Me.cboTaskListName = "111111" Then
Set db = CurrentDb()
SQL = "SELECT no1 from test"
Set rs = CurrentDb.OpenRecordset(SQL, dbOpenDynaset)
End If
End Sub

View 1 Replies View Related

Queries :: Duplicate Count From Group By Query

Jul 17, 2014

I'm trying to count the number of records within a region range using a lookup table however I keep getting duplicate values, SQL code, what is happening:

SELECT Count([summary].Key) AS CountKey
FROM Summary, lookup
WHERE ([Region])) Between [Region 1] And [Region 2]));

View 4 Replies View Related

Queries :: Hide Duplicate Record Using Query

May 18, 2015

I have a question on hiding duplication record using query.

The fields in the query are:

full name(trainee), NRIC(trainee), gender(trainee), preferred language(trainee), company(trainee), course name(course), course date(course), competent(course), class(course), L3 survey(trainee), L4 survey(trainee), num of month(course)

When the query is being run, it will show all the people that have not done the L3 and L4 survey after 3 month. The the query will be convert into a form. However the problem is that the record will show a few same name due to one person can take more than 1 course. therefore, the data in the course table will always be different.

How can i make the record only show 1 name even though they have different course name.

I had tried putting 'yes' for unique record and unique value but it did not change the result.

current SQL query:

SELECT DISTINCT trainee.[Full Name], trainee.NRIC, trainee.Gender, trainee.[Preferred Language], trainee.Company, course.[Course Name], course.[Course Date], course.Competent, course.Class, trainee.[L3 survey], trainee.[L4 survey], DateDiff('m',[Course Date],Date()) AS [Num of Month]
FROM trainee INNER JOIN course ON trainee.NRIC = course.NRIC
WHERE (((course.Competent)="c") AND ((trainee.[L3 survey])=False) AND ((DateDiff('m',[Course Date],Date()))>=3)) OR (((trainee.[L4 survey])=False) AND ((DateDiff('m',[Course Date],Date()))>=6));

View 6 Replies View Related

Queries :: Removing Duplicate Records In Query

Apr 24, 2014

Im trying to write a query that shows all the container movements. Yet when I run the query qryFullHistory I get a duplicate value for container Off Island. Ive tried adding some criteria that says that the DateRequested has to be between the ImportDate and ExportDate but that doesnt seem to work. There are duplicate entries for container Off Island in tblContainerDetails as the same container has arrived and left and then returned on another voyage. Yet there is no entry for the second voyage in the tblMEMRContainer.

A brief description of the tables is:
tblMEMR Movement requests details
tblMEMRContainers the containers that were moved on the movement request. There can be more than 1 container for each request.
tblContainerDetails details and dates for the container when it arrived and when it left

There are other tables but these are the 3 that are used in the query.

View 8 Replies View Related

Queries :: Custom Delete And Duplicate Query

Jun 12, 2013

I am trying to create a query to find duplicates and delete the duplicates. The result will eventually be used in another query (append query) to update a table.I have a table with 4 columns lets say for simplicity they are A, B, C, D

I want my query to find duplicates within B and deleting them. The catch is before deleting them I need to look into column A to ebsure they are actually duplicates. Example below

Example
A B
John Doe Tires
John Doe Wipers
Allison Doe Tires
Allison Doe Tires

As you can see from the above Tires is a duplicate and need to be deleted.

A B
John Doe Tires
John Doe Wipers
Allison Doe Tires

View 7 Replies View Related

Queries :: How To Manipulate Find Duplicate Query

Jun 15, 2013

I am trying to manipulate a find duplicates query using the following criteria:

Fstnm L2, Lstnm L5, Add1, Zip

This is what I have done so far:

SELECT [Duplicate Identification Dataset].[FSTNM], [Duplicate Identification Dataset].[LSTNM],
[Duplicate Identification Dataset].[ADD1], [Duplicate Identification Dataset].[ZIP],
[Duplicate Identification Dataset].[ID], [Duplicate Identification Dataset].[MIDNM],
[Duplicate Identification Dataset].[SPFSTNM], [Duplicate Identification Dataset].[SPMIDNM],

[Code] .....

View 1 Replies View Related

Queries :: Duplicate Results For Some Of Records In A Query

Dec 3, 2013

Why I am getting duplicate results for some of my records in a query. I have unique values set to Yes. I have also validated that the tables I am using don't have duplicate data. SQL is below.

SELECT DISTINCT [tbl_Rewards Activity Report - By Member Number].[Member Number],
[tbl_Rewards Activity Report - By Member Number].[Last Four],
[tbl_Rewards Activity Report - By Member Number].[BAL ID],
[tbl_Rewards Activity Report - By Member Number].[Primary Name],

[Code] .....

View 1 Replies View Related

Queries :: How To Remove Duplicate Records From A Query

Feb 11, 2014

I have this small database, I would like to have your support to setup this query "QryResults" in order to remove the duplicate records, I can't find a way to get shown only true records, for some reason I'm getting duplicate rows and fake values, the query is calculating operations from two different queries and a table.

View 3 Replies View Related

Queries :: Creating Query Without Repeating Duplicate Relationships

Feb 13, 2014

I have two tables that look like this:

Table 1

LOCATION NUMBER , SIZE
1.12 ,100
1.13 ,100
1.14, 12
1.15, 12
1.16 ,150
1.17 ,150
1.18 ,100

Table 2

ITEM , SIZE
A , 12
B , 12
C ,100
D ,12
E ,100
F ,100
G , 150

I would like to do a query that Joins the "Size" in each table, and then matches an "Item" to a "Location". However, because of how a normal join works, I cannot seem to figure out how to limit the "Location" field from producing duplicates in the match.

I only want to have 1 location for every 1 Item.

View 6 Replies View Related

Queries :: Insert Into Query - Duplicate Records In A Subform To New Form

Jun 4, 2013

I'm trying to duplicate the records in a subform to a new form but keep getting a too few parameters error.

Code:
strSql = "INSERT INTO [OrderDetailT] ( OrderID, ProductID, Quantity, DiscountPercentage ) " & _
"SELECT " & lngID & " As NewOrderID, ProductID, Quantity, DiscountPercentage " & _
"FROM [OrderDetailT] WHERE OrderNumber = " & Me.OrderNumber & ";"

The debug.print comes out as below:

INSERT INTO [OrderDetailT] ( OrderID, ProductID, Quantity, DiscountPercentage ) SELECT 49 As NewOrderID, ProductID, Quantity, DiscountPercentage FROM [OrderDetailT] WHERE OrderT!OrderNumber = 11;

View 4 Replies View Related

Queries :: Syntax In Query To Remove Duplicate Data For Field

Apr 26, 2013

I'm having difficulty with the syntax in this query to remove duplicate data for the field "StocktransID".

Code:
SELECT DISTINCT tblStockTrans.StockTransID, tblItem.Brand, tblItem.Category, tblItem.SubCategory,
tblItem.Model, tblItem.Description, IIf(TransTypeID=3,Quantity*-1,Quantity) AS Qty,
tblTransaction.TranstypeID, tblItem.ItemID, tblTransaction.TransactionID, tblItem.ItemType,
tblItem.Origin, tblOption.ParentID

[code]...

View 6 Replies View Related

Queries :: Decimal Format In Table Which Shows Latitude And Longitude

Sep 17, 2014

I have an Access 2010 table which shows Latitude and Longitude. However instead of it being in a decimal format it is displayed as 4000000000. I need to add a decimal point so that it looks like 40.00000000. If I configure the Field Properties to Decimal with a scale of eight and decimal places set to eight I can manually convert all of the data to the correct format. But I would like to have this happen automatically from a query.

View 4 Replies View Related

Command Button That Shows A Query

Aug 4, 2005

Hello,
How would I go about in making a command button bring up a report to show a result of items for the end of the month?
For example, when a user clicks on this button it will bring up a report showing all the items that are out of date for the end of the month. I am having problems with the query as for months have different lengths e.g. 28/29/30/31 days. How would I make a query show the end result for each month correct as February if going to be different each time i.e. when it is a leap year. I have got far but having trouble with this part.
Hope you can help.

View 3 Replies View Related

Need A Query That Shows Only Info With No Duplicates.

Sep 5, 2007

Okay I have a database that stores information on some payments.

Payments can be made on different dates and multiple times during the month.

There is an account number which will have duplicates in the table if there is more than one payment. This is fine.

However, I need a query which will show only those records for account numbers which appear only once.

So if it has duplicates, it is ignored, otherwise it's reported.

TIA for the help.

View 2 Replies View Related

Report That Shows Query Dependencies

Jan 8, 2012

I have a database that reuses many queries in several different macro's. Any way to generate a report, (or purchase an add-in), that will show for each query any other queries that use it. It would be ideal to show all of the "cascading" queries that one query is built on. It just gets confusing when I need to tweak a query to then have to figure out there are other queries that use the one that's being tweaked and the tweak will change the results of the other queries.

View 3 Replies View Related

Query That Shows Records Equalling Different Values

Aug 24, 2006

This is a very quick question. I have a query what i need it to do is show me all values that equal 2 and any records that are blank, this is what the criteria looks like currently

Field: Month([FDate])

Total:Group By

Criteria: Month([DDay1])

Now the way this works is it only shows records where the field meets the criteria, in this case Month([FDate]) = 2

I need the criteria to say if Month([DDay1])=Month([FDate]) Or is equal to "" Then display records.

EDIT: I just found out how to view blank values but what if records for it dont even exist... i still want to show the other fields..

Thanks
Jason

View 1 Replies View Related

Forms :: Totals Query That Shows Results In A Chart - No Parameter Selected

Dec 12, 2014

I have a totals query that shows results in a chart. It takes a parameter to limit results, by a combobox in a form.

Parameter in the query includes the OR "*" expression, in case someone wants to get the results unfiltered.

The Combobox in the form, has an AfteUpdate event that opens the chart (form) every time its value changes, by the [DoCmd.OpenForm "ChartForm" , acNormal] expression.

I don't know how to make it open the ChartForm when no parameter is selected in the combobox.

View 13 Replies View Related

Queries :: Query Records With Both Duplicate Values And Different Values?

Jun 18, 2013

I'm trying to determine the SQL to return only those records in a table which have duplicate values in each of two fields, but different values in a third field. Here's an example:

Code:

AcctNum FoodType FoodClass
------- -------- ---------
A123 Apple Fruit
A123 Apple Fruit
A123 Grape Fruit
A456 Potato Vegetable
A456 Potato Perishable
A789 Carrot Vegetable
A001 Banana Fruit

For the above table, I'm trying to return records which have multiple entries for AcctNum + FoodType, but DIFFERENT values for FoodClass. So for the above table, the query would return:

Code:

AcctNum FoodType FoodClass
------- -------- ---------
A456 Potato Vegetable
A456 Potato Perishable

It returns these two records because there is more than one record with for the AcctNum + FoodType (i.e. 'A456' + 'Potato'), but DIFFERENT values for FoodClass (i.e. one record has 'Vegetable' while the other has 'Perishable').

View 5 Replies View Related

Reports Showing ID Of Field Query Shows Name Of Field

Jun 6, 2014

I am trying to run graph on a report from query but what's happening is query shows name but report on graph shows ID'S of the field .

Below is my query

SELECT tblMainTWTTPSheet.txtRootCause, Count(tblMainTWTTPSheet.txtRootCause) AS CountOftxtRootCause
FROM tblMainTWTTPSheet
GROUP BY tblMainTWTTPSheet.txtRootCause, tblMainTWTTPSheet.Date
HAVING (((tblMainTWTTPSheet.txtRootCause) Is Not Null) AND ((Count(tblMainTWTTPSheet.txtRootCause)) Is Not Null) AND ((tblMainTWTTPSheet.Date) Between [Forms]![frmStratificationOfRootCauses]![startDate] And [Forms]![frmStratificationOfRootCauses]![endDate]));

My bound column on main menu form and back end table is 1

column count 2
column width 0;1

View 1 Replies View Related

Duplicate Records In Queries

May 10, 2006

I thought I had just about finished my DB but now Ive printed out and checked my reports I notice I have several records in different types of reports showing duplicate records. Iv'e gone back over the queries and there are one or two duplicates in several of my queries that I did not notice before because there are are only the odd one or two. No matter what I do I can't stop this happening. I think it must be something to do with the dates in my payment table. PaymentID is key field - foreign key is MemberID. One member can have several paymentID's a new one every year when membership renewed. The problem seems to be when the member has two payment dates in the same year. This shouldn't be anyway but the database has not been used properly with entry dates missing, written over of wrong dates etc. Ive tried to correct this but do not want to tamper with past payment date records. I already have 'select distinct' in my queries and have tried 'distinct row' which seems to return even more duplicate records. Im pulling my hair out over this there must be a way to return the records from members showing just 1 only of their very latest payment record/date. Im using this expression in the query.

LastPaid: (SELECT MAX(PaymentDate) FROM S_Payments_Table WHERE S_Payments_Table.MemberID =S_Members_Table.MemberID)

View 1 Replies View Related

Duplicate Entries And Queries?

Jul 30, 2007

Is there a way to find and remove duplicate entries in tables by using queries.....if so, how specifically?

View 1 Replies View Related

Queries :: No Duplicate Records

Oct 25, 2014

I have been hitting my head against the wall to have my query not show any DUPLICATE STOCK CODES in my report..I have two "AQN.PR.A" records, I only want my report to print one "AQN.PR.A"...I have three "ALA" records, I only want my report to print one "ALA"AQN.PR.A

View 14 Replies View Related







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