473,406 Members | 2,843 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Run Time Error 2110: cant move the SetFocus control

5
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 7284
Stewart Ross
2,545 Expert Mod 2GB
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
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...
8
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: ...
4
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....
1
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...
1
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,...
3
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...
7
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...
1
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",...
11
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...
0
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
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...

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.