Selasa, 15 Mei 2012

Re: [MS_AccessPros] Populate ListBox

Dear John,

Thank you very much, definitely its very simple & its working good, one
thing more I want to do is that when user erase or delete the text from
txtSearch the List box gone unfiltered I have tried this code but its not
working

If Me.txtSearch.Text = " " Then
Me.lst1.RowSource = "SELECT InventoryCode, InventoryName, [Qty
Available] " & _
"FROM Inventory " & _
"ORDER BY InventoryCode"
End If

On Wed, May 16, 2012 at 1:25 AM, John Viescas <JohnV@msn.com> wrote:

> **
>
>
> Abdul-
>
> Change the Row Source to an unfiltered query:
>
> SELECT Inventory.InventoryCode, Inventory.InventoryName,
> Inventory.[Qty Available] FROM Inventory
> ORDER BY Inventory.InventoryCode;
>
> Private Sub txtSearch_Change()
> ' Make sure there are at least 3 characters
> If Len(Me.txtSearch.Text) < 3 Then Exit Sub
> ' Change the Row Source to include a filter
> Me.lstProducts.RowSource = "SELECT InventoryCode, " & _
> "InventoryName, [Qty Available] FROM Inventory " & _
> "WHERE InventoryName LIKE '*" & _
> Replace(Me.txtSearch.Text, "'", "''") & "*' " & _
> "Order By InventoryCode"
> End Sub
>
> It's that simple.
>
>
> 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/
> (Paris, France)
>
> -----Original Message-----
> From: MS_Access_Professionals@yahoogroups.com
> [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Abdul
> Shakeel
> Sent: Tuesday, May 15, 2012 9:54 PM
> To: MS_Access_Professionals@yahoogroups.com
> Subject: Re: [MS_AccessPros] Populate ListBox
>
> Dear John
>
> Yes, what you say is exactly want to do with my list box I am currently
> using this query behind my list box as rowsource
>
> SELECT Inventory.InventoryCode AS Expr1, Inventory.InventoryName AS Expr2,
> Inventory.[Qty Available] AS Expr3
> FROM Inventory
> WHERE ((([Inventory].[InventoryName]) Like "*" &
> [forms]![frmSearchInventory]![txtSearch] & "*"))
> ORDER BY Inventory.InventoryCode;
>
> and on after update event of text box I call
> Me.MyList.Requery
>
> after typing the name of the product or some part of it when user hits
> enter the list is filter to the nearest one, but now I want to change it
> with "Find as you type" thing,I am glad to have share with me your
> application which starts searching after user type three words, or please
> give me any solution to do this, I am not going to use the code given in
> link I have share with you earlier because it some time hang and exhausted
> the whole database.
>
> On Wed, May 16, 2012 at 12:41 AM, John Viescas <JohnV@msn.com> wrote:
>
> > **
>
> >
> >
> > Abdul-
> >
> > Ah, that article talks about filtering an already populated list in a
> List
> > Box,
> > not adding entries. When you said "populate" I assumed you were adding
> > relevant
> > entries based on what the user typed in the text box. If you're filtering
> > an
> > existing list, then On Change is what you want to use, and the sample
> code
> > on
> > that page should help you do it. I've done a similar thing in some of my
> > apps,
> > but I test the length of the Text in the text box and only apply the
> filter
> > after the user types 3 or more characters. If you start filtering with
> the
> > first character typed, the list box will get filtered unnecessarily
> early.
> >
> >
> > 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/
> > (Paris, France)
> >
> >
> > -----Original Message-----
> > From: MS_Access_Professionals@yahoogroups.com
> > [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Abdul
> > Shakeel
> > Sent: Tuesday, May 15, 2012 9:17 PM
> > To: MS_Access_Professionals@yahoogroups.com
> > Subject: Re: [MS_AccessPros] Populate ListBox
> >
> > Dear John,
> >
> > I want to share a link with you, in this link is what I want to working
> > around but with simple code let only onChange Event do all the work,
> kindly
> > clear me about that if its possible.
> >
> >
> >
>
> http://www.opengatesw.net/ms-access-tutorials/Access-Articles/Search-As-You-Type
> > -Access.html
> >
> > On Tue, May 15, 2012 at 11:44 PM, John Viescas <JohnV@msn.com> wrote:
> >
> > > **
> >
> > >
> > >
> > > Abdul-
> > >
> > > Make the List Box a Value List, and use the .AddItem method of the List
> > Box
> > > control to put additional entries in the list. You probably want to use
> > the
> > > After Update event of the text box. If you use On Change, that event
> > fires
> > > for
> > > each character typed or erased. For example, if the user types
> > > "Abercrombie",
> > > the list box will contain all items:
> > >
> > > Like "A*"
> > >
> > > Like "Ab*"
> > >
> > > Like "Abe*"
> > >
> > > Like "Aber*"
> > >
> > > . and so on.
> > >
> > > 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/> http://www.viescas.com/
> > >
> > > (Paris, France)
> > >
> > > From: MS_Access_Professionals@yahoogroups.com
> > > [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Abdul
> > > Shakeel
> > > Sent: Tuesday, May 15, 2012 8:08 PM
> > > To: MS_Access_Professionals@yahoogroups.com
> > > Subject: [MS_AccessPros] Populate ListBox
> > >
> > >
> > > Dear All
> > >
> > > I want to populate a unbound listbox from an unbound textbox onChange
> > > event, both the controls are on same form, the list box contains
> product
> > > name & I want when user enters any word in the text box the listbox
> > > required with the word entered in the textbox using LIKE statement.
> > >
> > > [Non-text portions of this message have been removed]
> > >
> > > [Non-text portions of this message have been removed]
> > >
> > >
> > >
> >
> > [Non-text portions of this message have been removed]
> >
> > ------------------------------------
> >
> > Yahoo! Groups Links
> >
> >
> >
>
> [Non-text portions of this message have been removed]
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>


[Non-text portions of this message have been removed]



------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/MS_Access_Professionals/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/MS_Access_Professionals/join
(Yahoo! ID required)

<*> To change settings via email:
MS_Access_Professionals-digest@yahoogroups.com
MS_Access_Professionals-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
MS_Access_Professionals-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/

Tidak ada komentar:

Posting Komentar