473,387 Members | 1,431 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,387 software developers and data experts.

OnDirty....SetFocus

Hello All,

I know this may be easy for some people, but I need some help on a
little programming. I have this application that has been developed in
Access, there is a textbox call FindByName and a command button called
cmdFilter. What I would like to do is that when a user begins typing in
the textbox, that the focus would be on the command button. Then when
they hit the enter key it will hit the command button. If you guys
could help me out that would be super fantastic!

Thx

Tony

Nov 13 '05 #1
7 3290
Anthony Hendrata wrote:
Hello All,

I know this may be easy for some people, but I need some help on a
little programming. I have this application that has been developed in
Access, there is a textbox call FindByName and a command button called
cmdFilter. What I would like to do is that when a user begins typing in
the textbox, that the focus would be on the command button. Then when
they hit the enter key it will hit the command button. If you guys
could help me out that would be super fantastic!

Thx

Tony

Don't know if this will work, but in the text box's OnKeyDown enter
something like
If KeyCode = 13 And Shift = 0 then
cmdFilter_AfterUpdate
Endif

I will assume the afterupdate event for the command button is called
"cmdFilter_AfterUpdate"

Nov 13 '05 #2
If I understand what you want then make sure that the command button
is next in the Tab Order after the Text Box, you can if you wish set
the focus explicitly by entering CommandButton.SetFocus in
the After Update propery of the text box.
Patrick

On 20 May 2005 13:45:48 -0700, "Anthony Hendrata"
<an**************@gmail.com> wrote:
Hello All,

I know this may be easy for some people, but I need some help on a
little programming. I have this application that has been developed in
Access, there is a textbox call FindByName and a command button called
cmdFilter. What I would like to do is that when a user begins typing in
the textbox, that the focus would be on the command button. Then when
they hit the enter key it will hit the command button. If you guys
could help me out that would be super fantastic!

Thx

Tony


Nov 13 '05 #3
Hey Patrick,

Getting real close now, thanks for the help. Is there a way so that the
user will not have to hit the ENTER key twice? Once the user enters the
name and then hits the ENTER key, the focus is then put on the command
button. Then the user has to hit the ENTER key one more time. Is there
a way to just let the user hit ENTER once? Thanks alot for the help so
far!

Nov 13 '05 #4

Should be:

If KeyCode = 13 And Shift = 0 then
Call cmdFilter_Click
Endif

Nov 13 '05 #5
Chuck Grimsby wrote:
Should be:

If KeyCode = 13 And Shift = 0 then
Call cmdFilter_Click
Endif

Good catch.
Nov 13 '05 #6
How about a simpler way to do it?

Open the field's property sheet. Go to the "AfterUpdate" event. If the
Command Button has code in it, put the same code as the [Event
Procedure] for the "AfterUpdate" event. If the command button calls a
Macro, then put the same Macro name in the "AfterUpdate" event.

This will run the command without the user doing anything except
hitting ENTER. It will only do this if the user changes the contents in
the field.

Good luck!
Jim

Nov 13 '05 #7
Beautiful Chuck...works great!! Thanks alot!

Nov 13 '05 #8

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

Similar topics

4
by: JC | last post by:
I have a form based on a query. I have the OnDirty event launch a procedure that enables my custom "Save" button. I press Save after making my changes and the record is saved. At the end of the...
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....
8
by: Shachar | last post by:
Hi All, I need to start a new process calc for example and when ever the user click on the button the application should setfocus to the calc application. I use this code but it is NOT...
0
by: MrsLeigh | last post by:
I have a datagrid on a web page. In the footer there is a field that should be recieve the focus, either at the start or after a button is clicked to insert the row that is being added in the...
3
by: Jim Devenish | last post by:
In my application vehicles arrive and depart from a workshop. The ArrivalDate and the HandoverDate are each entered. Sometimes the person who should enter the arrival date forgets to do so. ...
12
by: Michael R | last post by:
TabCtrl --- ..............Tab1--Subform1 ..............Tab2--Subform2---TabCtrl2---Tab21 ..........................................................---Tab22...
0
by: srinivasarao yarru | last post by:
hi sir, in access 2003 how we can use the setfocuse property(we have to lostfocuse from one field with in that we have to setfocuse in same field) i am using this code but not setfocuse...
3
by: srinivasarao yarru | last post by:
hi in access 2003 how we can use the setfocuse property(we have to lostfocuse from one field with in that we have to setfocuse in same field) i am using this code but not setfocuse to same field...
5
agroover
by: agroover | last post by:
I can't seem to figure out how to get rid of the errors. I recieve the following error when I leave the Grade.SetFocus in my code... Microsoft Access can't move the focus to the control Grade ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.