Rabu, 28 Desember 2011

Re: [MS_AccessPros] Distinct Values

 

I'm not understanding your needs. If there may be multipe items in a box and you only want to disply unique BoxNumbers then change the SQL to:

SELECT [BoxNumber]
FROM tbl_Items
GROUP BY BoxNumber
ORDER BY [BoxNumber];

You could also use DISTINCT.

Since this is a list box, you may need to change the properties to match the row source: Column Count, Bound Column, Column Widths,...

Duane Hookom
MS Access MVP

--- In MS_Access_Professionals@yahoogroups.com, "yshopper" <jlinux@...> wrote:
>
> The Row Source for the list box has the Select statement. The Form is Single View.
>
> --- In MS_Access_Professionals@yahoogroups.com, "Clive" <zctek@> wrote:
> >
> > Hi John,
> >
> > Where are you using the Select statement? In the
> > form's RecordSource or in a ComboBox or somwhere
> > else?
> >
> > If you are using it in the Form's RecordSource
> > then change the Form's DefaultView to Single Form.
> >
> > Regards, Clive.
> >
> > --- In MS_Access_Professionals@yahoogroups.com, "John Viescas" <john@> wrote:
> > >
> > > John-
> > >
> > > If the combo box is bound to a field that matches ItemID, then you have no
> > > choice but to include it. If there are duplicate values for BoxNumber, one has
> > > to wonder why. Why do you have multiple items in the same BoxNumber?
> > >
> > > John Viescas, author
> > > Microsoft Office Access 2010 Inside Out
> > > Microsoft Office Access 2007 Inside Out
> > > Building Microsoft Access Applications
> > > Microsoft Office Access 2003 Inside Out
> > > SQL Queries for Mere Mortals
> > > http://www.viescas.com/
> > > (Lawton, OK)
> > >
> > >
> > >
> > > -----Original Message-----
> > > From: MS_Access_Professionals@yahoogroups.com
> > > [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of yshopper
> > > Sent: Tuesday, December 27, 2011 5:20 PM
> > > To: MS_Access_Professionals@yahoogroups.com
> > > Subject: Re: [MS_AccessPros] Distinct Values
> > >
> > > With no ItemID, the field goes blank, no entries.
> > >
> > > --- In MS_Access_Professionals@yahoogroups.com, Duane Hookom <duanehookom@>
> > > wrote:
> > > >
> > > > What happens if you get rid of the item ID?
> > > >
> > > > Duane Hookom
> > > > MS Access MVP
> > > >
> > > >
> > > > To: MS_Access_Professionals@yahoogroups.com
> > > > From: jlinux@
> > > > Date: Tue, 27 Dec 2011 18:03:54 +0000
> > > > Subject: Re: [MS_AccessPros] Distinct Values
> > > >
> > > > The Form shows all Box Numbers, not just the unique ones. So I have box
> > > numbers from 1-28 and the drop-down shows 10 box number 1, 8 box number 2, etc.
> > > I need the form to show just a single box number 1 and not every instance.
> > > > --- In MS_Access_Professionals@yahoogroups.com, Duane Hookom <duanehookom@>
> > > wrote:
> > > > > Looks good from here. Perhaps you can provide more details about your
> > > results.
> > > > > Duane
> > > >
> > > > > To: MS_Access_Professionals@yahoogroups.com
> > > >
> > > > > From: jlinux@
> > > >
> > > > > Date: Tue, 27 Dec 2011 17:14:40 +0000
> > > >
> > > > > Subject: [MS_AccessPros] Distinct Values
> > > > >
> > > >
> > > > > I have this Select statement on a form:
> > > >
> > > > > SELECT [tbl_Items].[ItemsID], [tbl_Items].[BoxNumber] FROM tbl_Items ORDER
> > > BY [BoxNumber];
> > > >
> > > > > How would I return just the Distinct or Unique values? I selected 'Yes' on
> > > Unique Values on the Query property sheet, but that did not work. I also tried
> > > this:
> > > > >
> > > >
> > > > > SELECT DISTINCT [tbl_Items].[ItemsID], [tbl_Items].[BoxNumber] FROM
> > > tbl_Items ORDER BY [BoxNumber];
> > > >
> > > > > But that didn't work either. Can someone please point me in the right
> > > direction?
> > > >
> > > > > Thanks,
> > > > > John

__._,_.___
Recent Activity:
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

Tidak ada komentar:

Posting Komentar