Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Runtime error 2110 when trying to set focus

Status
Not open for further replies.

jvanderw

Technical User
Aug 13, 2003
28
0
0
US
I am running the following bit of code in the on click event of a button:
If IsNull(Me.UseZip) Then
Msgbox "Please Note: 'Use zip code/Acct number opening' must be scored before continuing!"
Me.cmdGetNewFileInfo.SetFocus
Me.UseZip.SetFocus
End If

I get a runtime error 2110 that states:
Database can't move the focus to the control UseZip.
*The control may be a type that can't receive the focus, such as a label.
*The control's visible properties may be set to No.
*The control's enabled properties may be set to No.

The UseZip control is a combo box, and I have the visible and enabled properties set to yes. I have even double checked this by puting Me.UseZip.Visible = True and Me.UseZip.Enabled = True before I try to set focus, but to no avail.

Is there something that I am over looking?

Josh
 
My mistake, I should have deleted Me.cmdGetNewFileInfo.SetFocus before I copied the code to the forum. I was just trying to set focus to the button that has the "on click" event first. The code would still bomb out on Me.UseZip.SetFocus.
Any other thoughts?
Josh
 
Thanks Zameer, but I still get the same error. I am about at wits end with this problem!

Josh
 
Hi!

There's nothing wrong with setting focus to more than one control, only the last one will have the focus after the routine (in fact, this is used as a workaround for setting the focus back to a control when it has focus).

I can't see any specific reasons to why this shouldn't work, but some thought's:
[ul][li]You're sure UseZip is the name of the combo?[/li]
[li]Is there a field named UseZip in the forms recordsource too, if so, rename the combo to for instance cboUseZip[/li]
[li]Try the bang (!) syntax [tt]Me!UseZip[/tt] in stead[/li][/ul]

- else I'm stumped, and thinking in the direction of possible form corruption
Corrupt Microsoft Access MDBs FAQ
- one way to resolve, if this is the issue is Decompile or how to reduce Microsoft Access MDB/MDE size and decrease start-up times, even though it is marketed under something quite different;-)

Roy-Vidar
 
THANK YOU!!!!!!!!!!
The bang (!) worked!

Josh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top