Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / January 2005

Tip: Looking for answers? Try searching our database.

How can I GoToRecord in a List box?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JJ - 18 Jan 2005 19:21 GMT
Is there a way to have a vb code that will autimatically set the focus on a
list box in column 0 and go to the first record that is blank (is null) and
select it? if so, could someone provide me an example of the code...
Alex Dybenko - 19 Jan 2005 06:42 GMT
in order to "goto" (actually it is called select) in list box - set it to a
value of bound column, which one you want to have selected

also you can go through all items, see column property and selected property
in online help

Signature

Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com

> Is there a way to have a vb code that will autimatically set the focus on
> a
> list box in column 0 and go to the first record that is blank (is null)
> and
> select it? if so, could someone provide me an example of the code...
Tim Ferguson - 19 Jan 2005 16:16 GMT
> Is there a way to have a vb code that will autimatically set the focus
> on a list box in column 0 and go to the first record that is blank (is
> null) and select it? if so, could someone provide me an example of the
> code...

 if columns(0) is the bound column, then you can just iterate the
ItemData collection to find the first non-blank value; otherwise you can
look through the Column(column, row) array to find it.

 ' r is the row counter
 For r = 1 to lisMyList.ListCount-1
   If Len(lisMyList.Column(0,r))>0 Then
     ' found it
     lisMyList.Selected(4)=True
     Exit For

   End If
 Next r

 ' check for all blank
 If r = lisMyList.ListCount Then
   lisMyList.Enabled = False

 End If

or something like that

Hope it helps

Tim F
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.