listbox

I have a listbox in my Form. When I navigate to other records using the 
Form's navigator the listbox does not corresponds to the record. How do I 
make it to corresponds accordingly. 

Thanks in advance
0
Utf
3/4/2008 8:11:01 AM
access.formscoding 7493 articles. 0 followers. Follow

5 Replies
732 Views

Similar Articles

[PageSpeed] 15

ChoonBoy,
   Use the OnCurrent event of the form to Requery your listbox.  As you 
browse to each record, the Requery will "re-synch" the listbox according to 
some value on that particular record.
-- 
    hth
    Al Campagna
    Microsoft Access MVP
    http://home.comcast.net/~cccsolutions/index.html

    "Find a job that you love... and you'll never work a day in your life."

"ChoonBoy" <ChoonBoy@discussions.microsoft.com> wrote in message 
news:5A6F7F17-E890-442D-AA30-F03675A5CD80@microsoft.com...
>I have a listbox in my Form. When I navigate to other records using the
> Form's navigator the listbox does not corresponds to the record. How do I
> make it to corresponds accordingly.
>
> Thanks in advance 


0
Al
3/4/2008 1:51:38 PM
Al,

Thanks, but it still doesn't work for my form

me!lstSelect.requery

is the code I used in the Form's on current.

When I select using the listbox, the Form's navigation will synch with the 
record. However when I navigate using the navigator, the listbox remained in 
its last selection.

Thanks in advance.

Regards

"Al Campagna" wrote:

> ChoonBoy,
>    Use the OnCurrent event of the form to Requery your listbox.  As you 
> browse to each record, the Requery will "re-synch" the listbox according to 
> some value on that particular record.
> -- 
>     hth
>     Al Campagna
>     Microsoft Access MVP
>     http://home.comcast.net/~cccsolutions/index.html
> 
>     "Find a job that you love... and you'll never work a day in your life."
> 
> "ChoonBoy" <ChoonBoy@discussions.microsoft.com> wrote in message 
> news:5A6F7F17-E890-442D-AA30-F03675A5CD80@microsoft.com...
> >I have a listbox in my Form. When I navigate to other records using the
> > Form's navigator the listbox does not corresponds to the record. How do I
> > make it to corresponds accordingly.
> >
> > Thanks in advance 
> 
> 
> 
0
Utf
3/5/2008 3:55:05 AM
"When I select using the listbox, the Form's navigation will synch with the
record. However when I navigate using the navigator, the listbox remained in
its last selection."

If you're using the listbox for navigation purposes, it has to be unbound.
This is reinforced by your statement "when I navigate using the navigator,
the listbox remained in its last selection." This is the normal behavior for
an unbound control on a form. For it to show the value that was selected for
a given record, on the other hand, it would have to be bound to a field on
the underlying table. You can't really have it both ways.

-- 
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via http://www.accessmonster.com

0
Linq
3/5/2008 1:37:54 PM
ChoonBoy,
    Please cut and paste the entire code (procedure) you used in your next 
reply.

    Is the combobox "bound" to a field, or is it "unbound?"

    *Upon re-reading your initial post*, I'm wondering if you're using this 
"unbound" listbox to select a value, and use that value to locate a specific 
record.
    If that's true...
what is the value you are selecting in the listbox, and why is it necessary 
that the listbox synch to the record you navigate to.
    On my website, I have a 97 and 2003 sample file called Quick Find Combo 
(combo would work the same as a listbox in this regard)
    User selects a name from a combo, and that record is located.  But, when 
you manually navigate off that "found" record, the combo value (from the 
last find) is still there.  That's not a problem... that's how an "unbound" 
field works.  Whatever value is in the listbox, that value will remain... 
until changed.

    Let's say you select a CustomerID from the listbox, and find that 
CustomerID record.

    You could either...
    1. Use the OnCurrent to manually force the listbox to show that's 
records value.
Private Sub Form_Current()
  Me.lstSelect = Me.CustomerID
End Sub
    2. OnCurrent to Set the listbox to Null
Private Sub Form_Current()
  Me.lstSelect = Null
End Sub
-- 
    hth
    Al Campagna
    Microsoft Access MVP
    http://home.comcast.net/~cccsolutions/index.html

    "Find a job that you love... and you'll never work a day in your life."

"ChoonBoy" <ChoonBoy@discussions.microsoft.com> wrote in message 
news:1DAB2632-2292-424C-95E9-1D4FEFF1A3EB@microsoft.com...
> Al,
>
> Thanks, but it still doesn't work for my form
>
> me!lstSelect.requery
>
> is the code I used in the Form's on current.
>
> When I select using the listbox, the Form's navigation will synch with the
> record. However when I navigate using the navigator, the listbox remained 
> in
> its last selection.
>
> Thanks in advance.
>
> Regards
>
> "Al Campagna" wrote:
>
>> ChoonBoy,
>>    Use the OnCurrent event of the form to Requery your listbox.  As you
>> browse to each record, the Requery will "re-synch" the listbox according 
>> to
>> some value on that particular record.
>> -- 
>>     hth
>>     Al Campagna
>>     Microsoft Access MVP
>>     http://home.comcast.net/~cccsolutions/index.html
>>
>>     "Find a job that you love... and you'll never work a day in your 
>> life."
>>
>> "ChoonBoy" <ChoonBoy@discussions.microsoft.com> wrote in message
>> news:5A6F7F17-E890-442D-AA30-F03675A5CD80@microsoft.com...
>> >I have a listbox in my Form. When I navigate to other records using the
>> > Form's navigator the listbox does not corresponds to the record. How do 
>> > I
>> > make it to corresponds accordingly.
>> >
>> > Thanks in advance
>>
>>
>> 


0
Al
3/5/2008 1:38:40 PM
Al,

Your assumption is correct. The code you provided does exactly what I wanted.

Thanks & regards


"Al Campagna" wrote:

> ChoonBoy,
>     Please cut and paste the entire code (procedure) you used in your next 
> reply.
> 
>     Is the combobox "bound" to a field, or is it "unbound?"
> 
>     *Upon re-reading your initial post*, I'm wondering if you're using this 
> "unbound" listbox to select a value, and use that value to locate a specific 
> record.
>     If that's true...
> what is the value you are selecting in the listbox, and why is it necessary 
> that the listbox synch to the record you navigate to.
>     On my website, I have a 97 and 2003 sample file called Quick Find Combo 
> (combo would work the same as a listbox in this regard)
>     User selects a name from a combo, and that record is located.  But, when 
> you manually navigate off that "found" record, the combo value (from the 
> last find) is still there.  That's not a problem... that's how an "unbound" 
> field works.  Whatever value is in the listbox, that value will remain... 
> until changed.
> 
>     Let's say you select a CustomerID from the listbox, and find that 
> CustomerID record.
> 
>     You could either...
>     1. Use the OnCurrent to manually force the listbox to show that's 
> records value.
> Private Sub Form_Current()
>   Me.lstSelect = Me.CustomerID
> End Sub
>     2. OnCurrent to Set the listbox to Null
> Private Sub Form_Current()
>   Me.lstSelect = Null
> End Sub
> -- 
>     hth
>     Al Campagna
>     Microsoft Access MVP
>     http://home.comcast.net/~cccsolutions/index.html
> 
>     "Find a job that you love... and you'll never work a day in your life."
> 
> "ChoonBoy" <ChoonBoy@discussions.microsoft.com> wrote in message 
> news:1DAB2632-2292-424C-95E9-1D4FEFF1A3EB@microsoft.com...
> > Al,
> >
> > Thanks, but it still doesn't work for my form
> >
> > me!lstSelect.requery
> >
> > is the code I used in the Form's on current.
> >
> > When I select using the listbox, the Form's navigation will synch with the
> > record. However when I navigate using the navigator, the listbox remained 
> > in
> > its last selection.
> >
> > Thanks in advance.
> >
> > Regards
> >
> > "Al Campagna" wrote:
> >
> >> ChoonBoy,
> >>    Use the OnCurrent event of the form to Requery your listbox.  As you
> >> browse to each record, the Requery will "re-synch" the listbox according 
> >> to
> >> some value on that particular record.
> >> -- 
> >>     hth
> >>     Al Campagna
> >>     Microsoft Access MVP
> >>     http://home.comcast.net/~cccsolutions/index.html
> >>
> >>     "Find a job that you love... and you'll never work a day in your 
> >> life."
> >>
> >> "ChoonBoy" <ChoonBoy@discussions.microsoft.com> wrote in message
> >> news:5A6F7F17-E890-442D-AA30-F03675A5CD80@microsoft.com...
> >> >I have a listbox in my Form. When I navigate to other records using the
> >> > Form's navigator the listbox does not corresponds to the record. How do 
> >> > I
> >> > make it to corresponds accordingly.
> >> >
> >> > Thanks in advance
> >>
> >>
> >> 
> 
> 
> 
0
Utf
3/5/2008 3:46:01 PM
Reply:

Similar Artilces:

Having Trouble Adding VK_DELETE processing to a ListBox
This function allows me to add keyboard processing to my DialogBox. The <Insert> key works correctly, the <Delete> seems to invoke OnDeleteListBox() twice. BOOL MultiFontDialog::PreTranslateMessage(MSG* pMsg) { if (pMsg->wParam == VK_INSERT) { OnInsertListBox(); return TRUE; } else if (pMsg->wParam == VK_DELETE) { OnDeleteListBox(); return TRUE; } return CDialog::PreTranslateMessage(pMsg); } "Peter Olcott" <NoSpam@SeeScreen.com> wrote in message news:AHzKh.41478$907.358@newsfe13.phx... > This function allows me to add keyboa...

Displaying Window Icons in Listbox.
i want to display local files and directories in a list box in my program. i am able to retrieve tht but i want to display respective icons against the file name. File extensions can be retrieved using GetExtension in mfc. i want to display the icons using Windows, NOT create my own bitmaps. kindly suggest how to go about it. Send this message WM_GETICON,Use SendMessageTimeout <nemesia31@gmail.com> wrote in message news:1161063177.331791.48490@h48g2000cwc.googlegroups.com... >i want to display local files and directories in a list box in my > program. i am able to retrieve tht b...

The multi-select listbox/dropdown/whatever with checkboxes
Hi all, Spent a good day searching the groups and learned that it does not seem to be possible to use some type of dropdown with checkboxes. I find it very hard to accept that a product like Office2k7 offers such a flexible way to filter your data (dropdowns on column headers in both Excel/Access) and not provide some interface to such a dropdown for developers. Is Access truly this back-to-stoneage that I have to buy/get me some custom build controls library in order to have such flexible filtering at my disposal as a starting developer? Or do I have to do this the rough'n tough way an...

Background image or transparency in ListBox
Hi. I'm looking for some ListBox derived class that give me en opportunity to make my ListBox transparent (I have a background on my dialog and want to make only text visible and selectable on my ListBox) or set some background image to ListBox so the only text will be visible (with no white rectangle on background). Do you now something like that? Of course first of all I tried google to help me, but search gave me useless results. Thanks. -- German Koninin --------------------------------------------------------------------- For every complex problem, there's solution that is simp...

How to retrieve data from unbound listbox.
I'm trying to retrieve data from a multi-column, unbound listbox. Suppose you create a simple unbound listbox with 2 columns. Then use the following to fill the listbox: ListBox1.AddItem("a;1") ListBox1.AddItem("b;2") Suppose the user highlights the second row, the one with a "b" in the 1st column. How would I retrieve the data in column 2 (in this case a 2)? On Thu, 17 Dec 2009 12:59:02 -0800 (PST), cr113 wrote: > I'm trying to retrieve data from a multi-column, unbound listbox. > > Suppose you create a simple unbound lis...

howto define definitions for cells
I need to know how to pull a cell from one sheet to another. I have alot of information on sheet 1 and instead of retyping it to sheet two I would like to be able to pull it from sheet1. For instance, if I have BC on sheet one, I would like to click on a cell in sheet two and be able to choose the value BC from a listbox ...

issue with row source of listbox
Hi, I need help with the following issue. In the form, i have a listbox whose row source made up of two different tables. In one of the field i set it up as follows Expr1: IIf(Not IsNull([Subject_Name]) Or [Subject_Name]<>"",[Subject_Name],[OldSubject_Name]) I was trying to get it to show up in the listbox in the view mode but to no avail. Is it to do with the fact that it's not one of the fields exist in the table? How do i work around this? Thank you in advance On Mon, 11 Feb 2008 20:38:00 -0800, Associates <Associates@discussions.microsoft.com> wrote: &...

Changing the scrollbar/arrows size for Access listboxes.
I'm writing a touchscreen app and the listbox scrollbar is very hard to use for fat fingers. Does anyone know of a way to programatically make the scrollbar and arrows bigger? I don't want to change system- wide settings to achieve this sit it's just one screen I need this for. I know some MVP out there has this mastered but I couldn't find anything in the newsgroup. Any help would be much appreciated! Thanks, James It's not possible on a per form/window/control basis. An alternative is to hide the Access ListBox's ScrollBar using an ActiveX ScrollBar control which ...

Next Record in ListBox
Is there an easy way to move to the next record in a list box after the list box has been clicked on? Martin Hi, you can use following code: If Me.MyListbox.ListCount > 0 Then Me.MyListbox.Selected(1) = True end if -- Best regards, ___________ Alex Dybenko (MVP) http://accessblog.net http://www.PointLtd.com "Martin" <Martin@discussions.microsoft.com> wrote in message news:40D2CCF5-0F84-4A49-94F4-6D2E37C8F82F@microsoft.com... > Is there an easy way to move to the next record in a list box after the > list >...

Records in Listbox Identified in Reverse Order
Hello, I have a list box that is populated as data is entered into the form. (I'm reusing a database that worked well, but needed editing for a different project.) In the original database, the records were identified correctly--first item entered is record 1, second item entered is record 2,... In the "new" database (I had to modify some data sources), the items are in reverse. The first item entered is record 2, the second item entered is record 1,... Any idea why this is occurring? I've checked what I know to check and cannot tell what the problem ...

Listbox Question
I have userform4 where I have put a command button and listbox on it, this is connected to a sheet called Hidden. I want to allow the user to select the text in the userbox and click on the command button to delete that certain entry on the worksheet. Is this possible, How to I acheive this to happen. Thanks in advance Greg ...

Multiple listbox questions
I have a sales/cost/profitability report that with lots of help from posters here I have managed to create a form to filter it by several criteria and its all working well, I'm just tweaking it some now and have a few questions: First I have 2 listboxes 1 for customers (we currently have 346 listed), 1 for lots (we currently have 663 listed). On both of them (both multiselect) the slider does not work quiet right. On first load if you drag the slider all the way to the bottom, it only goes down about half the list, release the mouse button and the slider appears mid way do...

Color output to ListBox windows
A simple question with a very low likelihood of an affirmative answer: Can data output be done in color to the list box window ? Thank you, Andrew. "Andrew K." <Andrew K.@discussions.microsoft.com> wrote in message news:67BD3632-E897-4555-8B41-D93991912DD2@microsoft.com... > A simple question with a very low likelihood of an affirmative answer: > > Can data output be done in color to the list box window ? Yes. Use WM_CTLCOLORLISTBOX or ownerdraw it depending on your needs. -- Jeff Partch [VC++ MVP] "Jeff Partch" wrote: > "Andrew K." ...

Listbox not populating every time
I have a form that has two listboxes. Both listboxes are on frmAccount. LISTBOX 1: Show investments inside an account This listbox shows data from tblPositions (a linked csv txt file) In the SQL of the listbox, I set the criteria of AccountNumber field of the table to equal Forms!frmAccount!AccNumber. LISTBOX 2: Show transactions of an account This listbox shows account transactions from tblTransactions (a linked csv txt file) In the SQL of the listbox, I set the criteria of AccountNumber field of the table to equal Forms!frmAccount!AccNumber. The idea of my SQL was to limit so that it ...

Problems in Creation of unicode enabled ListBox control for VB.....
Hi all, I am creating one custom listbox unig MFC's activex control wizard. My main purpose is to get a VB listbox which is unicode aware.I want to use it in VB. And I want every property VB ListBox has already. To achieve that I just build my project in DebugUnicode mode. It is subclassing from "LISTBOX". I made some property/method/events as stock & some are custom. Now the problems are as follows: 1. Thogh I made BackColor/ForeColor property as stock property,still its not working . 2. I am unable to create check box style for the listbox. 3. I have created "List&quo...

vba listbox question
How do i add stuff to a second column in a vba listbox.. i feel reall stupid but i've tried endlessly and searched the internet with n joy... Also how can i use info from a particular column.. eg. Surname/name are 2 column headings (assuming i can get stuff in the 2n colum) i wanna take data from 'surname' without takin the 'name' data wit it... I know this is really simple basic stuff so can someone put me out o my misery -- Message posted from http://www.ExcelForum.com Could someone please help me? This is really annoying and i can't get o with my work until i...

Refresh ListBox while running code
Greetings all. windows xp. xl97. Is there a way to show and refresh a listbox while the code is running that updates it? I have a search form that allows a user to enter a part number or part description and search for first match or all matches. if the user selects the part description and chooses to search for all matches, I would like for the listbox to appear on the form and update as the records appear in the temp table. I would then like to add a command that would allow the user to stop the search if they see what they need appear in the listbox. Any help would be appreciated. -doo...

listbox -shows table of information
I have a listbox which displays a table of chemicals (1st column) and their properties - density (2nd column) and other propeties (3rd, 4th, 5th column etc) When I open the userform the table of chemicals is displayed and i can select a row of chemicals (highlighted in blue). I already have another userform which allows me to enter new chemicals to add to the list and I have txt boxes for entering the chemical data Here is the code i use for that Private Sub cmdAdd_Click() Application.EnableEvents = False Dim iRow As Long Dim ws As Worksheet Set ws = Worksheets("Ch...

Listbox remains highlighted but not desired behavior
Hi, I hope this makes sense to some one here. I have three list boxes on a form. lstReportName, lstTime and lstBatch. A click event shows the next box and allows you to choose. Let's say you click on Report1, that shows lstTime and you click 6AM. But before you run it you change you mind and decide you want Report2, you click that and you see 6AM and 11AM but the 6AM is still highlighted. I want them to be un-highlighted once you've made another choice as it was in the beginning. How can I stop this behavior? Thanks in advance. "OMS" <ooigooee@dreamskillet.com...

Serialize a ListBox
I have a dialog-based utility with several controls and a listbox. I have been able to successfully serialize all of the controls except the listbox. I ran it in debug with the .IsSerializable function and it returned false. Why is the listbox the only control on the dialog that is not serializable? What am I missing? Thanks in advance for your help. Kevin "Kevin" <anonymous@discussions.microsoft.com> wrote in message news:034401c3a183$ee9a4060$a101280a@phx.gbl... > I have a dialog-based utility with several controls and a > listbox. I have been able to success...

Multiselect Listbox
Dear all, In my form there is a multiselect listbox. Inside this listbox there are some dates, for example: 01/01/07, 01/02/07, 01/03/07, 01/04/07... I made a code that consist: each time that I select one date in my multiselect listbox, in my subform appear one textbox. The problem is: In my subform there are only 12 textbox and in the multiselect listbox can exist more than 12 dates, and the code below in not flexible, because I only can use the first twelve dates from the sequence of dates in the multiselect listbox; and I would like that it pick the first 12 dates that the user selected...

ListBox Horizontal scrolling
Hello, Need advise on how to make the Horizontal scrolling in a ListBox control to work. I did set the flags to ON of both H & V scrolling options; the Vertical part works perfect, the Horizontal did not even appear .....! According to MSDN everything should go 'automatically' ..... . Please advise - THANKS! ;-) Saya <sayasendiri@hotmail.com> wrote in message news:4brkiv4o7oh1rr0tdt0vjovtt428fedo67@4ax.com... > Hello, > > Need advise on how to make the Horizontal scrolling in a ListBox > control to work. > I did set the flags to ON of both H & V scrollin...

selecting listbox items
I have a listbox that when selecting item/items, it prints it on a report, unselected items won't be printed but it would leave space. For ex. item 1 - selected item 2 - selected item 3 - not selected item 4 - not selected item 5 - selected so in print report, it should print the selected ones, and leave the not selected a blank space item 1 item 2 <blank> <blank> item 5 I understand that you can filter the selection in a listbox but It would print only as w/o the blank space. item 1 item 2 item 5 I want to leave spaces for the unselected items. How should I do it? -- ...

Populating a subform from a listbox
Hi all, Having spent the last couple of days banging my head against my monitor trying to work this out - I thought I would turn it out to the gurus here. I'm working with a form (FrmClientEnquiries) which will populate records in TblClientEnquiries. Based on the user's selection in a listbox of 'RequestType' (LboRequestType), I need the subform (sFrmRespChecks) to populate a series of records based on the various 'Resp' asociated with the 'RequestType'. Tables include: TblRequestTypes RTID (PK; autonumber) RequestType (eg: CID, Doc Check, Account Na...

Remaining data in ListBox
Hello, I am developping an application in VBA/Access (MDB file). To deliver the app to my client, I create a MDE file. The problem is that the app crashes sometimes, and then my client says that he can see in the listbox of one of my forms several lines of data that obviously remain from my tests. I mean that it seems that when I create the MDE file, the Listbox keeps some remainings of the data that was displayed when I was testing the app, and these lines appear when the application crashes. I wonder if this is a normal behaviour of the ListBox, and if it is possible to remove this data ...