removing focus on an information field

sisterpete

Registered User.
Local time
Today, 17:56
Joined
May 20, 2010
Messages
13
we have a field on our form called "Searchbox" that is for search criteria. for example, if i put "321" in the field, i will get all the records with "321" either in their social security number or the drivers license number.

when there is more then one matching record, a seperate field called "txMoreThanOneRec" that has been hidden up to this point appears telling the user something like "119 records found. use the record selector buttons below to view other records."

here's the problem.. when this new field appears, the cursor moves to that box and all the text is actually highlighted. i want the cursor to either stay in the searchbox field, or move to the "first name" field.

i do not want it to place focus on the the "txMoreThanOneRec" field, and i surely dont want the text highlighted. i have searched and searched the web tonight, tried a number of different things, to no avail.

i haven't programmed much on access, and what i did has been several years ago. i recently took over the admin on a small network of computers at a food and clothing outreach facility.

i spent a few hours tonight redoing the graphic interface, making it more pleasing to the eye, making dropdown menus automatically drop down when the cursor lands on one, etc.

while i know this is nothing that will stop us from using the program, as they have been using it this way for several years, its just something that bothers me because it's looks tacky and is one more step for the user to have to fool with.

thank you for your help with this matter.
 
Go to the offending field and set the properties Tab Stop to No
 
The easiest solution is to take the text-field "txtMoreThanOneRec" out of the TabOrder on your form.

Go to the property of your textbox and set Tabulator to No.

JR
 
tab stop to "no" doesn't help at all... tried that... actually it's stills et that way.

i've went to properties and cannot find "tabulator" anywhere??? using access 2003

the only fields i see are

auto tab "off"
tab stop "off"
tab index "23"

thanks for the replies...
 
this may be either code in the

afterupdate event for the search box (possibly beforeupdate)

or in a button click event that you click to search


the thing is, if you do the search in the after update event, then the focus leaves the search box, in order to fire that event - and presumably, the activated box is now the next box to get the focus. You may actually be speicfically setting the focus there in code.

you may be able to put code like

"searchbox.setfocus" in the after update event, so that the search box keeps the focus

-----------
show us the code you are using for the search, if you still have problems
 
i've went to properties and cannot find "tabulator" anywhere??? using access 2003

As you can see under my profile I have a norwegian version of Access so sometimes I have to guess what other versions uses for names, sometimes I get it wrong. ;)

But you stated that Tab Stop No diden't work :confused: , It works like a charm when I do it, you don't by any chance have some VBA code running that forces a SetFocus to the textbox.

You can use the AfterUpdate event of your searchbox to set focus to another control on your form

Code:
Private Searchbox_AfterUpdate()
Me!SomeControl.SetFocus
End Sub

JR
 
There is always the Screen.PreviousControl.Setfocus approach
 
ok... thanks to all who replied... i honestly have no idea about code... im at lest smart enough to work on a copy of the database, if i change something change it back if it doesnt work, etc... and thats how i learn,,,

so, from you guys telling me to try certain things, and after trying them and looking at that code, it makes some sense to me...

so when you said it may be in the code that the searchbox is setting focus to the new box.... i looked and it was... i had looked at that early on last night, but at that point had no idea what set focus was all about...

that's it!!! it works just fine now...

thanks to all who replied... and thank you for allowing me to tap into your knowedge of access... i'm sure i'll be back...
 
one more question... when i go to properties and click on the little ... for an event edit, on one of the computers, it goes right to visual basics, but on the other computer it pops up a box asking me to select the builder i want

expression builder
macro builder
code builder

just wondering what is different

thanks
 
one more question... when i go to properties and click on the little ... for an event edit, on one of the computers, it goes right to visual basics, but on the other computer it pops up a box asking me to select the builder i want

expression builder
macro builder
code builder

just wondering what is different

thanks

That is a Per User Setting and if you are on Access 2003 or earlier you can go to TOOLS > OPTIONS > FORMS/REPORTS and check the box ALWAYS USE EVENT PROCEDURES.
 
On final thing about setting focus.

You can dynamically enable and disable controls (.Enabled=True or false) - but if you disable ALL the controls through some combination of events, you will probably get a focus-related error message because Access really wants a form to have a place to park the focus. The form (as a whole) cannot get focus unless no controls remain to accept the focus, and the implications of that are complex - because it means you have no controls that are able to regain focus.

Just be careful if you decide to use VBA to muddle about with focus issues.
 
here's one for you... once my text-field "txtMoreThanOneRec" pops up, i have the background color set to "red" to call attention to it. i would like it to flash on and off, so in searching the web i found this... it's for the foreground color, which i understand needs to be changed, but this is for an out of date issue... i just want it to flash all the time when it appears. so can you tell me what would change on here to work for my need.

thanks

Private Sub Form_Timer()
If [RequiredDate] < Date Then
If [RequiredDate].ForeColor = vbRed Then
[RequiredDate].ForeColor = vbBlack
Else
[RequiredDate].ForeColor = vbRed
End If
End If
End Sub
 
On final thing about setting focus.

You can dynamically enable and disable controls (.Enabled=True or false) - but if you disable ALL the controls through some combination of events, you will probably get a focus-related error message because Access really wants a form to have a place to park the focus. The form (as a whole) cannot get focus unless no controls remain to accept the focus, and the implications of that are complex - because it means you have no controls that are able to regain focus.

Just be careful if you decide to use VBA to muddle about with focus issues.


thanks for the info... i like your status as a "certified grandpa" ha ha me too... nothing like it in the world....
 
can you tell me what would change on here to work for my need.
Code:
Private Sub Form_Timer()
   If [RequiredDate].ForeColor = vbRed Then
      [RequiredDate].ForeColor = vbBlack
   Else
      [RequiredDate].ForeColor = vbRed
   End If
End Sub
 
Code:
Private Sub Form_Timer()
   If [RequiredDate].ForeColor = vbRed Then
      [RequiredDate].ForeColor = vbBlack
   Else
      [RequiredDate].ForeColor = vbRed
   End If
End Sub


i am not needing a required date, only want it to flash all the time... so i understand that "required date" should be removed, but not for sure about the "if" part... since there are no variables that im looking for, just flashing always. thanks
 
i am not needing a required date, only want it to flash all the time... so i understand that "required date" should be removed, but not for sure about the "if" part... since there are no variables that im looking for, just flashing always. thanks

Okay, let's do this again and have you try to look past the required date.

You need to just substitute the control that you want to flash.

Code:
Private Sub Form_Timer()
   If [[B]YourControlNameHere[/B]].ForeColor = vbRed Then
      [[B]YourControlNameHere[/B]].ForeColor = vbBlack
   Else
      [[B]YourControlNameHere[/B]].ForeColor = vbRed
   End If
End Sub
 
Okay, let's do this again and have you try to look past the required date.

You need to just substitute the control that you want to flash.

Code:
Private Sub Form_Timer()
   If [[B]YourControlNameHere[/B]].ForeColor = vbRed Then
      [[B]YourControlNameHere[/B]].ForeColor = vbBlack
   Else
      [[B]YourControlNameHere[/B]].ForeColor = vbRed
   End If
End Sub

Thanks... learning here... but that made sense once i "looked past" and realized i needed my control name...

It Worked!!! one last queston for the day... hopefully... dont want to overstay my welcome... i added the flashing background and set my time interval... is there a way to either stop the flashing after so long, or make the box dissapear... the reason, is that once it tells the user that there are a certain number of records matching their criteria, when you begin to look at the different records, this box doesnt go away and after a while gets annoying...

thank you so much for all the information... i have truly learned some things today..

God bless...
 

Users who are viewing this thread

Back
Top Bottom