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 / General 2 / June 2007

Tip: Looking for answers? Try searching our database.

ListBox Operation Putting Form Into Some Kind Of State?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
(PeteCresswell) - 12 Jun 2007 00:50 GMT
When this code runs:
---------------------------------
3030    With Me.lstIssuers
3031       If .ListCount > 0 Then
3032          .SetFocus
3033          .ListIndex = 0   'Force selection of first row
3034       End If
3035    End With
3036    Me.cmdClose.SetFocus
---------------------------------

It traps out on line# 3036.

If I rem that line out, it will trap out on the next statement
that attempts to do a .SetFocus to some other control

The error is 2110 "Can't move focus to control" and if I step
through the code, the explanation that pops is

"Macro or function set to BeforeUpdate or ValidateRule property
for this field is preventing [application name] from saving data
in the field."

If I rem out the offending code (lined 3030-3026) there are no
problems.

Anybody been here?
Signature

PeteCresswell

Dirk Goldgar - 12 Jun 2007 01:54 GMT
> When this code runs:
> ---------------------------------
[quoted text clipped - 23 lines]
>
> Anybody been here?

No, but if this is a single-select list box, try ditching the SetFocus
and selecting the first item this way:

   With Me.lstIssuers
       If .ListCount > 0 Then
           .Value = .ItemData(0)
       End If
   End With

That's also assuming that the control's ColumnHeads property is set to
False.  Otherwise a small amendment is necessary.

Signature

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

(PeteCresswell) - 12 Jun 2007 16:55 GMT
Per Dirk Goldgar:
>No, but if this is a single-select list box, try ditching the SetFocus
>and selecting the first item this way:
[quoted text clipped - 7 lines]
>That's also assuming that the control's ColumnHeads property is set to
>False.  Otherwise a small amendment is necessary.

Worked like a charm.

Thanks!!!
Signature

PeteCresswell

 
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.