473,507 Members | 11,134 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

runtime error 2110 can't move focus

I have a combo box in which a user can select a number of "1" or "0".
if the user selects "1" it changes the visible property on other
controls that were initial set to "Flase" to "True" .

the code works until i added the set focus.

why do i get this the runtime error? it says it cannot move the focus
to the control.

the cboVehicleLog IS enabled and NOT locked

here is my code:

If tester = "1" Then
cboVehicleLog.Visible = True
cboFleet.Visible = True

cboVehicleLog.SetFocus
End If

Aug 7 '06 #1
1 18182

pa*******@gmail.com wrote:
I have a combo box in which a user can select a number of "1" or "0".
if the user selects "1" it changes the visible property on other
controls that were initial set to "Flase" to "True" .

the code works until i added the set focus.

why do i get this the runtime error? it says it cannot move the focus
to the control.

the cboVehicleLog IS enabled and NOT locked

here is my code:

If tester = "1" Then
cboVehicleLog.Visible = True
cboFleet.Visible = True

cboVehicleLog.SetFocus
End If
Hmmm, a couple of wild guesses without seeing everything else...

Is the name of cboVehicleLog the name of your control *and* your
datasource? If thats the case then VBA will have some issues as to
which it's addressing. The cbo prefix you have on there probably
indicates this isn't the issue.

Also, when exactly are you changing the cbovehiclelog field to
invisible? You said that it was initially set to false, but I don't see
the 'Else cboVehiclelog.visible = false statement. Do you have that
somewhere else? Are you SURE the error is occuring at the INSTANT you
set the fields focus or is it perhaps at a different time, say a time
when you set the cboVehicleLog to invisible? An invisible field can't
have the focus.

My 2cents

Aug 7 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2238
by: SHC | last post by:
Hi all, I did the "Build" on the attached code in my VC++ .NET 2003 - Windows XP Pro PC. On the c:\ screen, I got the following: Microsoft Development Environment An unhandled exception of type...
8
4033
by: Steve | last post by:
I have several pairs of synchronized subforms in an application. I have a Delete button for each pair that uses the following code or similar to delete a record in the second subform: ...
7
1552
by: saurabh | last post by:
Hey, I have a form in which there are say 10 fields. I am using validator control for all the fields. suppose user forgets to fill field no. 5, 8 , 9 and 10. So on clicking the save...
1
6038
by: Sankalp | last post by:
Hi, I am using VB 2005. My application has many data bound controls. The connection is stored in the app.config file. I want the application to start with a default connection string and while...
1
3034
by: finditajr | last post by:
Hello I'm having the following problem: My main webpage calls a function stored in a .js file that creates an HTML window to display a calendar. Whenever I click on a date in that calendar,...
1
3867
by: mudasserrafiq | last post by:
I am using following asp file default.asp <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <META http-equiv=Content-Type content="text/html; charset=windows-1252"> <META content="0...
2
19403
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
1
7292
by: jvborg | last post by:
I am experiencing a problem when trying to move the setfocus to text field txtSearchDump, if i do not place the text into this field the query which i am initially trying to run does not execute. Any...
0
2897
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7110
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7030
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7482
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1540
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.