473,666 Members | 2,039 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Run Time Error 2110: cant move the SetFocus control

5 New Member
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 advice would be very helpful

Thanks
Joe

Expand|Select|Wrap|Line Numbers
  1. Select Case Me.optSearchCriteria.Value
  2.         Case 1
  3.             strSQL = strSelect & strFrom & strTitle
  4.         Case 2
  5.             strSQL = strSelect & strFrom & strDescription
  6.         Case 3
  7.             strSQL = strSelect & strFrom & strSubmitter
  8.         Case 4
  9.             strSQL = strSelect & strFrom & strOwner
  10.     End Select
  11.  
  12.     Me!txtSearchDump.SetFocus             ' *** Error occurs here when i try to move the set focus *** '
  13.     Me!txtSearchDump.Text = strSQL
  14.     CurrentDb.QueryDefs("qryCoreSearch").SQL = strSQL
  15.     Me.lstCoreSearch.Requery
  16. End Sub
Oct 13 '08 #1
1 7300
Stewart Ross
2,545 Recognized Expert Moderator Specialist
Hi, and Welcome to Bytes!

There could be several reasons for the SetFocus not working, and at this stage without knowing more about your app I'd rather not guess.

You are using the .Text property of the control concerned - which is, as you have found, only available when the control has the focus. Instead of this, you just need to set the value of the control, which can be done without using setfocus at all. As the .Value property is the default for a control there is no need to refer to it explicitly:

Expand|Select|Wrap|Line Numbers
  1. Select Case Me.optSearchCriteria.Value
  2.         Case 1
  3.             strSQL = strSelect & strFrom & strTitle
  4.         Case 2
  5.             strSQL = strSelect & strFrom & strDescription
  6.         Case 3
  7.             strSQL = strSelect & strFrom & strSubmitter
  8.         Case 4
  9.             strSQL = strSelect & strFrom & strOwner
  10.     End Select
  11.  
  12.     Me!txtSearchDump = strSQL
  13.     CurrentDb.QueryDefs("qryCoreSearch").SQL = strSQL
  14.     Me.lstCoreSearch.Requery
  15. End Sub
-Stewart
Oct 13 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
4614
by: Paul | last post by:
I have an Access 2000 database with a form that is giving me some major headaches. When you open the form, it displays all records and allows editing, but has AllowAdditions set to False so that the user has to use my New Record button. When you click the New Record button, the form presents a new record for editing. My client wants to use the Escape key to cancel changes to new or existing records. On existing records, Access already...
8
4051
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: DoCmd.SetWarnings False DoCmd.RunCommand acCmdDeleteRecord DoCmd.SetWarnings True End If ExitHere: Me!SubName.SetFocus
4
9674
by: Mad Scientist Jr | last post by:
i am trying to set focus to a specific control depending on the outcome of a validator control and it is not working. none of these methods are working to setfocus: 1. RegisterStartupScript("sf","<scriptlanguage='javascript'>document.form.MyControlID.focus();</script>"); 2. Andy Smith's FirstFocus control from http://www.metabuilders.com/tools/FirstFocus.aspx
1
18200
by: patskinny | last post by:
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
1
1783
by: Eric | last post by:
When I run my script it gives error on the following line: strEmail = Right(strEmail, (Len(strEmail) - 1)) I enclose my code and the sample text file too Thanks, ----------------------------------------------------------------------------- Option Compare Database Option Explicit Private Sub Command26_Click()
3
2756
by: moni | last post by:
Hi, I wanted to convert a time value in the form of time_t into a readable form in C# or vice versa, in order to be able to subtract two time values and give the result in msecs. eg. I have a time value,
7
8072
by: kiwipedia | last post by:
Hi all I have a combo-box control which I've set as a required field. It's a date and uses a calendar as coded below. All works fine unless the user deletes a pre-existing value (leaving a 0-length string I guess) and then clicks in the Insertion control. This results in Runtime error '2110' with the message that "can't move the focus to the control Calendar0" I think this is because I've made Insertion a required field - certainly the...
1
1157
kirubagari
by: kirubagari | last post by:
Private Sub enter_Click() On Error GoTo errHandler ' If mDirty = True Then 'mdirty mean weather the byte have been changed or not ' Dim tmp ' tmp = MsgBox("Byte(s) changed; save to file", vbYesNoCancel + vbQuestion) ' If tmp = vbCancel Then 'Exit Sub 'ElseIf tmp = vbYes Then
11
5579
by: xenoix | last post by:
hey there, im reasonably new to C# and im currently writing a backup application which im using as a learning resource. My PC :- Visual Studio 2005 .NET Framework 2 Component Factory Krypton Tools Test PC :- .Net Framework 2
0
8448
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8552
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8640
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6198
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5666
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4369
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1776
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.