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

Problems bringing focus back to form

Hi

I'm new to this group so go easy on me!

I currently use a database that has had one constant niggle for a while and
I was wondering if anybody can help sort it out. From an opening screen
there is an option to search for a particular record. The search criteria is
entered into a text box. A form is presented over the top of the opening
screen with the query results and an option is then given for another
search. This results in the open form closing down, but the text box on the
opening screen has to be clicked in to bring the focus back to the search
box. Could somebody please advise how the cursor can be made to flash in the
box immediately the screen is presented, without having to click?

MTIA

MD
Nov 12 '05 #1
13 3198
Martin,
Some code on the 'On activate'-event will do the trick for you

Private Sub Form_Activate()
Me!Searchbox.setfocus
End sub

--
Hope this helps
Arno R
"Martin Dennett" <md**@ntlworld.com> schreef in bericht
news:ay********************@newsfep2-win.server.ntli.net...
Hi

I'm new to this group so go easy on me!

I currently use a database that has had one constant niggle for a while and
I was wondering if anybody can help sort it out. From an opening screen
there is an option to search for a particular record. The search criteria is
entered into a text box. A form is presented over the top of the opening
screen with the query results and an option is then given for another
search. This results in the open form closing down, but the text box on the
opening screen has to be clicked in to bring the focus back to the search
box. Could somebody please advise how the cursor can be made to flash in the
box immediately the screen is presented, without having to click?

MTIA

MD

Nov 12 '05 #2
TC
Or, just put the searchbox first in View Tab Order.

TC
"Arno R" <ar****************@tiscali.nl> wrote in message
news:3f**********************@dreader2.news.tiscal i.nl...
Martin,
Some code on the 'On activate'-event will do the trick for you

Private Sub Form_Activate()
Me!Searchbox.setfocus
End sub

--
Hope this helps
Arno R
"Martin Dennett" <md**@ntlworld.com> schreef in bericht
news:ay********************@newsfep2-win.server.ntli.net...
Hi

I'm new to this group so go easy on me!

I currently use a database that has had one constant niggle for a while and I was wondering if anybody can help sort it out. From an opening screen
there is an option to search for a particular record. The search criteria is entered into a text box. A form is presented over the top of the opening
screen with the query results and an option is then given for another
search. This results in the open form closing down, but the text box on the opening screen has to be clicked in to bring the focus back to the search box. Could somebody please advise how the cursor can be made to flash in the box immediately the screen is presented, without having to click?

MTIA

MD


Nov 12 '05 #3
Hi TC,
I had a guess that the OP hit Enter or clicked another button to view the results.
Since the form stays open, just taborder won't help I think.

Arno R

"TC" <a@b.c.d> schreef in bericht news:1070257697.353471@teuthos...
Or, just put the searchbox first in View Tab Order.

TC
"Arno R" <ar****************@tiscali.nl> wrote in message
news:3f**********************@dreader2.news.tiscal i.nl...
Martin,
Some code on the 'On activate'-event will do the trick for you

Private Sub Form_Activate()
Me!Searchbox.setfocus
End sub

--
Hope this helps
Arno R
"Martin Dennett" <md**@ntlworld.com> schreef in bericht
news:ay********************@newsfep2-win.server.ntli.net...
Hi

I'm new to this group so go easy on me!

I currently use a database that has had one constant niggle for a while and I was wondering if anybody can help sort it out. From an opening screen
there is an option to search for a particular record. The search criteria is entered into a text box. A form is presented over the top of the opening
screen with the query results and an option is then given for another
search. This results in the open form closing down, but the text box on the opening screen has to be clicked in to bring the focus back to the search box. Could somebody please advise how the cursor can be made to flash in the box immediately the screen is presented, without having to click?

MTIA

MD





Nov 12 '05 #4
TC
Yes, good thinking!

TC
"Arno R" <ar****************@tiscali.nl> wrote in message
news:3f**********************@dreader2.news.tiscal i.nl...
Hi TC,
I had a guess that the OP hit Enter or clicked another button to view the results. Since the form stays open, just taborder won't help I think.

Arno R

"TC" <a@b.c.d> schreef in bericht news:1070257697.353471@teuthos...
Or, just put the searchbox first in View Tab Order.

TC
"Arno R" <ar****************@tiscali.nl> wrote in message
news:3f**********************@dreader2.news.tiscal i.nl...
Martin,
Some code on the 'On activate'-event will do the trick for you

Private Sub Form_Activate()
Me!Searchbox.setfocus
End sub

--
Hope this helps
Arno R
"Martin Dennett" <md**@ntlworld.com> schreef in bericht
news:ay********************@newsfep2-win.server.ntli.net...
> Hi
>
> I'm new to this group so go easy on me!
>
> I currently use a database that has had one constant niggle for a while
and
> I was wondering if anybody can help sort it out. From an opening
screen > there is an option to search for a particular record. The search

criteria is
> entered into a text box. A form is presented over the top of the opening > screen with the query results and an option is then given for another > search. This results in the open form closing down, but the text box

on the
> opening screen has to be clicked in to bring the focus back to the

search
> box. Could somebody please advise how the cursor can be made to
flash in the
> box immediately the screen is presented, without having to click?
>
> MTIA
>
> MD
>
>



Nov 12 '05 #5
Unfortunately, the Form_activate () didn't work :-(

I'm not overly familiar with VB so I don't know for sure but the guy who
amends our code said he'd tried it in various places and still drawn a
blank.

MD

"TC" <a@b.c.d> wrote in message news:1070329018.52910@teuthos...
Yes, good thinking!

TC
"Arno R" <ar****************@tiscali.nl> wrote in message
news:3f**********************@dreader2.news.tiscal i.nl...
Hi TC,
I had a guess that the OP hit Enter or clicked another button to view the
results.
Since the form stays open, just taborder won't help I think.

Arno R

"TC" <a@b.c.d> schreef in bericht news:1070257697.353471@teuthos...
Or, just put the searchbox first in View Tab Order.

TC
"Arno R" <ar****************@tiscali.nl> wrote in message
news:3f**********************@dreader2.news.tiscal i.nl...
> Martin,
> Some code on the 'On activate'-event will do the trick for you
>
> Private Sub Form_Activate()
> Me!Searchbox.setfocus
> End sub
>
> --
> Hope this helps
> Arno R
>
>
> "Martin Dennett" <md**@ntlworld.com> schreef in bericht
> news:ay********************@newsfep2-win.server.ntli.net...
> > Hi
> >
> > I'm new to this group so go easy on me!
> >
> > I currently use a database that has had one constant niggle for a
while and
> > I was wondering if anybody can help sort it out. From an opening screen > > there is an option to search for a particular record. The search
criteria is
> > entered into a text box. A form is presented over the top of the opening > > screen with the query results and an option is then given for another > > search. This results in the open form closing down, but the text
box on the
> > opening screen has to be clicked in to bring the focus back to the
search
> > box. Could somebody please advise how the cursor can be made to flash in the
> > box immediately the screen is presented, without having to click?
> >
> > MTIA
> >
> > MD
> >
> >
>
>



Nov 12 '05 #6
> Unfortunately, the Form_activate () didn't work :-(
I'm not overly familiar with VB so I don't know for sure but the guy who
amends our code said he'd tried it in various places and still drawn a
blank.


The 'guy who amends your code' does only need to try in one place
and that's the Form_Activate event ...
(Why isn't this guy posting himself?)

Check if and when the event is triggered. Put a line like
msgbox "Check on_activate"
as the first line in your code.

What are you doing exactly? Is there a click on a button to show
the "form that is presented over the top of the opening screen"
How is the "option is then given for another search".

An alternative approach:
You could also set the focus back to the desired field BEFORE showing the " form that is ..."

--
Hope this helps
Arno R


Nov 12 '05 #7
> (Why isn't this guy posting himself?)

I said I'd do the dirty work :-)
Check if and when the event is triggered. Put a line like
msgbox "Check on_activate"
as the first line in your code.

What are you doing exactly? Is there a click on a button to show
the "form that is presented over the top of the opening screen"
How is the "option is then given for another search".

An alternative approach:
You could also set the focus back to the desired field BEFORE showing the

" form that is ..."

I'll see if the above works - failing that I'll ask him to mail me the code
and I'll post it here.

MD
Nov 12 '05 #8
> I'll see if the above works - failing that I'll ask him to mail me the
code
and I'll post it here.


OK - I got the code - here it is:

Private Sub Command84_Click()
DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE recheckhold.* FROM recheckhold;"

DoCmd.Close acForm, "dc2"
Forms!SWITCHBOARD!OLEUnbound180.Visible = False
Forms!SWITCHBOARD!Text17.Visible = True
Forms!SWITCHBOARD!Text17.SetFocus
Forms!SWITCHBOARD!Text17 = ""
Forms!SWITCHBOARD!Command13.Visible = False
Forms!SWITCHBOARD!Command14.Visible = False
Forms!SWITCHBOARD!Command15.Visible = False
Forms!SWITCHBOARD!Command16.Visible = False
Forms!SWITCHBOARD!Command19.Visible = False
Forms!SWITCHBOARD!Command78.Visible = False
Forms!SWITCHBOARD!Command82.Visible = False
Forms!SWITCHBOARD!Command164.Visible = False
End Sub

The "RunSQL" statement clears the fields in a holding table. "SWITCHBOARD"
is the main form that the search criteria is entered on. The information is
displayed on form "dc2". When closing form dc2 to return to SWITCHBOARD
using the "search again" button - that's when the problem occurs. Text17 is
the box that the cursor is not appearing in.

Hope this helps in some way.

MD
Nov 12 '05 #9
Martin,
- This code runs from your form dc2?
Code 'should' work IMO provided that NO OTHER code AFTER this code runs.
Check the code in your Switchboard form especially the On_Activate-event.
- Try moving the line Forms!SWITCHBOARD!Text17.SetFocus as the LAST line

- What version of Access ?
- Dis you try all the other options I mentioned?

BTW: I don't see code to SetWarnings True again after the RunSQL; don't forget this ...
--
Hope this helps
Arno R
"Martin Dennett" <md**@ntlworld.com> schreef in bericht
news:GW****************@newsfep1-gui.server.ntli.net...
I'll see if the above works - failing that I'll ask him to mail me the

code
and I'll post it here.


OK - I got the code - here it is:

Private Sub Command84_Click()
DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE recheckhold.* FROM recheckhold;"

DoCmd.Close acForm, "dc2"
Forms!SWITCHBOARD!OLEUnbound180.Visible = False
Forms!SWITCHBOARD!Text17.Visible = True
Forms!SWITCHBOARD!Text17.SetFocus
Forms!SWITCHBOARD!Text17 = ""
Forms!SWITCHBOARD!Command13.Visible = False
Forms!SWITCHBOARD!Command14.Visible = False
Forms!SWITCHBOARD!Command15.Visible = False
Forms!SWITCHBOARD!Command16.Visible = False
Forms!SWITCHBOARD!Command19.Visible = False
Forms!SWITCHBOARD!Command78.Visible = False
Forms!SWITCHBOARD!Command82.Visible = False
Forms!SWITCHBOARD!Command164.Visible = False
End Sub

The "RunSQL" statement clears the fields in a holding table. "SWITCHBOARD"
is the main form that the search criteria is entered on. The information is
displayed on form "dc2". When closing form dc2 to return to SWITCHBOARD
using the "search again" button - that's when the problem occurs. Text17 is
the box that the cursor is not appearing in.

Hope this helps in some way.

MD

Nov 12 '05 #10
Arno
"Arno R" <ar****************@tiscali.nl> wrote in message
news:3f**********************@dreader2.news.tiscal i.nl...
Martin,
- This code runs from your form dc2?
Code 'should' work IMO provided that NO OTHER code AFTER this code runs.
Check the code in your Switchboard form especially the On_Activate-event. - Try moving the line Forms!SWITCHBOARD!Text17.SetFocus as the LAST line
- What version of Access ?
- Dis you try all the other options I mentioned?

BTW: I don't see code to SetWarnings True again after the RunSQL;

don't forget this ...

It's Access 97 - forgot to mention that. I passed on your previous comments
but I've had no feedback yet. I'll pass this over too and let you know how
it goes.

Martin
Nov 12 '05 #11
"Martin Dennett" <md**@ntlworld.com> wrote in message
news:DD***************@newsfep1-gui.server.ntli.net...
It's Access 97 - forgot to mention that. I passed on your previous comments but I've had no feedback yet. I'll pass this over too and let you know how
it goes.


Arno - changes made and still no joy I'm afraid...

MD
Nov 12 '05 #12
Martin,
I would like to see what's happening here.
If you e-mail the mdb I will try to help you out.
Maybe you can 'strip' the mdb and mainly leave the two forms concerned here?
Remove the obvious (n_o_s_p_a_m) from my address.

Arno R.
"Martin Dennett" <md**@ntlworld.com> schreef in bericht
news:iE*************@newsfep1-gui.server.ntli.net...
"Martin Dennett" <md**@ntlworld.com> wrote in message
news:DD***************@newsfep1-gui.server.ntli.net...
It's Access 97 - forgot to mention that. I passed on your previous

comments
but I've had no feedback yet. I'll pass this over too and let you know how
it goes.


Arno - changes made and still no joy I'm afraid...

MD


Nov 12 '05 #13
"Arno R" <ar****************@tiscali.nl> wrote in message
news:3f**********************@dreader2.news.tiscal i.nl...
Martin,
I would like to see what's happening here.
If you e-mail the mdb I will try to help you out.
Maybe you can 'strip' the mdb and mainly leave the two forms concerned here? Remove the obvious (n_o_s_p_a_m) from my address.


The *whole* mdb - all 460Mb of it? :-)

Leave it with me, and I'll send you the forms, modules and a small amount of
data, just so you can see what's going on.

Martin
Nov 12 '05 #14

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

Similar topics

1
by: Jens Körte | last post by:
Hi NG! I encountered some strange behaviour when using focus() I use a form with several input-fields. A user can enter stuff. After entering I want to check the value, i.e. that a number is...
17
by: Neil Ginsberg | last post by:
OK, this is a stupid thing, but I can't seem to get this to work. I have a form with a subform (in continuous form view). A combo box on the main form has code in the AfterUpdate event which adds a...
7
by: John | last post by:
Hi, I have a group of controls in a panel on the right-hand side of a splitter and a treeview on the left-hand side. The only configuration that I can find to make the right-hand side resize...
7
by: Martin Hazell | last post by:
I have had a form within a project that has been tested and working for the past 4-5 months. The other day, I decided to change all of my database connection strings into a dynamic property for a...
12
by: E Goforth | last post by:
Hello, I have a VB6 app that calls a VB.NET app via named pipes and a third party component. Inside the VB.NET app I'm trying to force a form to the top, at least temporarily. Inside a form's...
0
by: Scott Emick | last post by:
I have a main entry screen for a contact manager that has some buttons which can launch various other forms and these launch without any problems. I check if the form already exists and set focus...
2
by: Tom | last post by:
I am developing a VB.NET user control that is composed of a component control (along with some classes, etc). This is probably a stupid question, and should be easy, but I must be having a brain...
3
by: papalarge | last post by:
I have a VB.NET application that consists of a toolbar and a subwindow that I want to function together and not independently. So when I give focus to one, I want to make sure that the other is...
5
by: Michel Posseth [MCP] | last post by:
Hello we have encountered the following problems with the date time picker control A : datetime picker control gives focus to last entered field when moving back and forward with focus how do...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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:
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
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.