473,396 Members | 2,030 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,396 software developers and data experts.

Form Focus for search

I've been up most of the night trying to get the basic searcg (find
record) facility to pre focus on a particular fielf so that it only
searches that field and returns the data for the whole form.
Here what i have been attempting to alter to set the focus just prior
to the search.

Private Sub Search_Payrollno_Click()
On Error GoTo Err_Search_Payrollno_Click
Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70

Exit_Search_Payrollno_Click:
Exit Sub

Err_Search_Payrollno_Click:
MsgBox Err.Description
Resume Exit_Search_Payrollno_Click
End Sub

but if I've clicked on any other field it uses that selected field
instead of the one I want to limit the user to searching in. All
offers most welcome.

Many Thanks
Nemesis
Nov 13 '05 #1
3 2922
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Just set the focus to the control you want to search on. Assuming you
want to set the focus on the control Payrollno you'd do this:

Me!Payrollno.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQQIKzYechKqOuFEgEQJmjwCgp3ySlmc7V1agKeLnaesNy8 D45kIAoMnh
iY1NieJ+o96mTPkAdOZxwlUE
=f8AU
-----END PGP SIGNATURE-----
Nemesis wrote:
I've been up most of the night trying to get the basic searcg (find
record) facility to pre focus on a particular fielf so that it only
searches that field and returns the data for the whole form.
Here what i have been attempting to alter to set the focus just prior
to the search.

Private Sub Search_Payrollno_Click()
On Error GoTo Err_Search_Payrollno_Click
Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70

Exit_Search_Payrollno_Click:
Exit Sub

Err_Search_Payrollno_Click:
MsgBox Err.Description
Resume Exit_Search_Payrollno_Click
End Sub

but if I've clicked on any other field it uses that selected field
instead of the one I want to limit the user to searching in. All
offers most welcome.

Many Thanks
Nemesis


Nov 13 '05 #2
Many Thanks for your suggestion, but no joy. I added your lines but
now get the message object doesn't support
this property or method. Any ideas?

thanks

nemesis
MGFoster <me@privacy.com> wrote in message news:<8V******************@newsread1.news.pas.eart hlink.net>...
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Just set the focus to the control you want to search on. Assuming you
want to set the focus on the control Payrollno you'd do this:

Me!Payrollno.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQQIKzYechKqOuFEgEQJmjwCgp3ySlmc7V1agKeLnaesNy8 D45kIAoMnh
iY1NieJ+o96mTPkAdOZxwlUE
=f8AU
-----END PGP SIGNATURE-----
Nemesis wrote:
I've been up most of the night trying to get the basic searcg (find
record) facility to pre focus on a particular fielf so that it only
searches that field and returns the data for the whole form.
Here what i have been attempting to alter to set the focus just prior
to the search.

Private Sub Search_Payrollno_Click()
On Error GoTo Err_Search_Payrollno_Click
Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70

Exit_Search_Payrollno_Click:
Exit Sub

Err_Search_Payrollno_Click:
MsgBox Err.Description
Resume Exit_Search_Payrollno_Click
End Sub

but if I've clicked on any other field it uses that selected field
instead of the one I want to limit the user to searching in. All
offers most welcome.

Many Thanks
Nemesis

Nov 13 '05 #3
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Is there a control named "Payrollno" on the form that is running the VBA
code? To set the focus on a control using the Me! referent the code
must be on the form that holds the control.

If you have an Access version 97 (I believe) or higher you can use the
RunCommand method instead of the MenuItem method. E.g.:

Me!Payrollno.SetFocus
DoCmd.RunCommand acCmdFind

I tested this & it worked for me.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQQRqoIechKqOuFEgEQIAcwCffKaRTXXzTOOxBFVWY3dZz0 HXL+YAoMwp
s8zrmMu1bWd2axjxtQ3g0sEK
=6Anc
-----END PGP SIGNATURE-----
Nemesis wrote:
Many Thanks for your suggestion, but no joy. I added your lines but
now get the message object doesn't support
this property or method. Any ideas?

thanks

nemesis
MGFoster <me@privacy.com> wrote in message news:<8V******************@newsread1.news.pas.eart hlink.net>...
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Just set the focus to the control you want to search on. Assuming you
want to set the focus on the control Payrollno you'd do this:

Me!Payrollno.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQQIKzYechKqOuFEgEQJmjwCgp3ySlmc7V1agKeLnaesNy8 D45kIAoMnh
iY1NieJ+o96mTPkAdOZxwlUE
=f8AU
-----END PGP SIGNATURE-----


Nov 13 '05 #4

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

Similar topics

3
by: NB | last post by:
Let's say in the product table I have around 50,000 products (well, infact it has now about 2000 only, but it's growing very fast, hence the question here) In the order form, users will select...
3
by: Simone | last post by:
Hi All, I have a Find Record button setup in most of my forms in order to find a specific customer's details. I have just noticed today though that this search will only find the customer if it...
8
by: Zlatko Matić | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the...
1
by: tdmailbox | last post by:
Is there a vb command that can tell me if I have focus in the child or parent form? Basicly I have a search macro that needs me to have focus to any field in the parent form. If my focus is set...
8
by: copyco | last post by:
I want to be able to test if my app's form has focus, (ie: not in background, behind other windows). How can I do this? I tried the Me.Focused, but that doesn't work. I think it's because a...
14
by: Fr15ky | last post by:
First of all, I am using the .NET 2.0 framework with Visual Studio 2005. I have two forms. One is a form with a TreeView control on it (used as a menu - kindof a favorites list) and the other is...
8
by: M.L. | last post by:
Hello. I created a form using JS validation with the form tag as follows: <form name="form1" action="dynaform.php" method="post" onsubmit="return pvg_sub();"> The js validation script sends...
0
by: =?Utf-8?B?TWljaGFlbA==?= | last post by:
Hi Everyone, I have an issue thats bugging me some. I have a search form that I created to search for clients in the database from the Client form. User selects the client from a list and the...
9
by: AMBLY | last post by:
Hello ! Hope someone might be able to help me with this one. I run Access2000 on XP. I have a form : frmONE- which contains a txt field: ctrCTN from my table/database. The values in ctrCTN are...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
0
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...

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.