Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 27th, 2005, 01:31 PM
Authorized User
Join Date: Dec 2005
Location: , , .
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default Select an particular item when a listbox opens?

1) I have a listbox of names which is populated by one of several queries, selected by VBA according to the user's selection on a form. I want to fix it so that when the listbox opens the item highlighted is the first name alphabetically. I wrote code which identifies the correct name, the problem is that I can't find how to make the list box select it.

2)I was surprised to find that the requery method seems to have no effect while the action works just fine - any clues to why that is?

Me.lstPicklist.Requery 'This method doesn't have any effect
DoCmd.Requery "lstPicklist" 'This works fine


Reply With Quote
  #2 (permalink)  
Old December 27th, 2005, 06:50 PM
Friend of Wrox
Join Date: Jun 2003
Location: , , USA.
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts

Hi Alastair,

lstListBox.Selected(0) = True

lstListBox.Selected(1) = True, would highlight the second item in the list, and so on.



Reply With Quote
  #3 (permalink)  
Old December 29th, 2005, 06:04 PM
Authorized User
Join Date: Dec 2005
Location: , , .
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks, that's got it. As for the other problem, I think there's something weird with the form so I'm going to start over.
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
ListBox Item selection caterpillar ASP.NET 1.0 and 1.1 Professional 1 July 26th, 2006 12:50 PM
select statement with listbox item(where qnsID =" Astro VB How-To 2 August 31st, 2005 02:12 AM
One item in Listbox venterjo General .NET 2 February 1st, 2005 05:45 AM
How to get selected Item from Listbox? Iceman571 ADO.NET 1 March 25th, 2004 06:33 AM
listbox, different color for each item? MichaelTJ ADO.NET 1 November 13th, 2003 10:37 PM

All times are GMT -4. The time now is 07:52 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.