473,396 Members | 2,036 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,396 software developers and data experts.

How do I stop records with same field number showing?

Hello everyone!

I'm using Access 2000 and working with an old database but need some help. I have a query displaying information from the database each week which has several columns, date, invoice number, name, address etc. However I only want to show one record from each invoice number meaning that the invoice numbers will be sequential and not have duplicates popping up. How would I go about doing this? Sorry I have no clue when it comes to this stuff.


Thanks
Robert
Jun 30 '10 #1
4 1231
jimatqsi
1,271 Expert 1GB
A lot depends on the table designs in your DB, which we can't know.

Maybe you want to query only the invoice heading table and maybe you are currently querying the heading joined to the line item details? In that case, just cruise the heading table and report what's there.

But if your DB has heading and detail info in one table you don't have that choice. Or maybe you want something that is stored in the detail table and is the same on every line item. In that case you want to add grouping to the query. If you group by Invoice number (and all the other fields that repeat on multiple line items), you'll get only one row returned for each invoice.

Jim
Jun 30 '10 #2
NeoPa
32,556 Expert Mod 16PB
As Jim says, you leave us with little pertinent information.

Generally then, there are two options that can restrict your output to a single line per invoice :
  1. The DISTINCT predicate of the SELECT clause.
  2. The GROUP BY clause.
With a better understanding of your position we may be able to assist further.

Welcome to Bytes!
Jun 30 '10 #3
Okay here is an example of my query

Date Invoice No Name ...........
21/06/10 978207 GARROWHILL BOWLING CLUB
21/06/10 978208 ALLFIT JOINERS
22/06/10 978213 CBG/CRL
22/06/10 978213 CBG/CRL

In the date field I have "21/06/2010" And "25/06/2010" to show all records from last week and notice the last two lines are duplicates which are completely different records but have the same customer under the same invoice number. I just want to show one line with invoice 978213 and hide the rest. Thanks for you help.
Jul 1 '10 #4
NeoPa
32,556 Expert Mod 16PB
In this particular case you could use the DISTINCT predicate of the SELECT clause :
Expand|Select|Wrap|Line Numbers
  1. SELECT DISTINCT
  2.        [Date]
  3.       ,[Invoice No]
  4.       ,[Name]
  5. FROM   [YourTable]
Jul 1 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

15
by: shaqattack1992-newsgroups | last post by:
Hello Everyone, Let me explain my problem. I have included 2 dashes between each pair of records to make it easier to see what goes together. In reality, it is just a long list of results...
2
by: Joost Kraaijeveld | last post by:
I have a table with column1, column2, column3 and column4. How do I get all records, sorted by column4 that have the same column1,column2 and column3? TIA Joost ...
3
by: Aliriazi | last post by:
All, I have created a simple database, which includes a receiving table and outgoing table in my receiving table I have a multiple entry of the same fields. I am trying to create a query that...
31
by: MRHIGHSPEED | last post by:
Hi all. I'm new here and fairly new to building databases. Learned a lot in designing this one, but I am stuck on this one last expression. I'm trying to create a calculated control. The form is...
2
by: Takeadoe | last post by:
Dear NG - I may be nuts, so forgive me for bothering you. There is a text variable in my table that shows up in design view, but is no where to be found in the datasheet view. The field should be...
6
JKing
by: JKing | last post by:
I'm using an update query to update a single field in a table. Table1 is part of my normalized table structure. Table2 is used solely as an import table for raw data which I sort and summarize...
2
by: rhepsi | last post by:
Hii all, I have a project where before i upload the data from 1st database to 2nd database, im truncating the 2nd database and then trying to upload... In this process, wat i found was that:...
7
by: =?Utf-8?B?TG91IDYy?= | last post by:
010498007741048 This number pops up in search boxes at intermittent times..I have no idea why it does or how to delete it. Could it be some kind of malware or virus/spyware running in the...
1
by: krikaran adel | last post by:
Hi, First of all I found your tips very usfull, of course these tips becuas of all years working in access. really greet site. my Quation: is this away to change fonts in reports so the...
3
by: mjmars2 | last post by:
I am in desperate need of some assistance with some VBA code I am working on. Here's what I'm trying to do: I have two forms- is the main form and is another form that pops up when you click a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.