.SetFocus to NOTHING! (1 Viewer)

Randomblink

The Irreverent Reverend
Local time
Today, 10:27
Joined
Jul 23, 2001
Messages
279
Ok...
I am creating sections on forms where I want the user to select ONE option from a listbox or combo-box and the make that listbox or combo-box invisible.

All I want to ask is this:

If the only thing on my form is a LOCKED/DISABLED textbox or listbox...and I want to move the focus OFF OF the current object...

How can I move it OFF of the object I am about to make invisible when there is nothing else I can move it to?

Am I stuck? Can I make this happen?

Help!

Thanks in advance!
 

Fornatian

Dim Person
Local time
Today, 16:27
Joined
Sep 1, 2000
Messages
1,396
Have you tried setting focus to the form itself?

Me.SetFocus?

I know the form has an OnGotFocus event but not sure if it will take the focus if there are controls on the form - locked or unlocked. Another alternative is to have a zero-width text box hidden behind something that you can setfocus to.
 

Randomblink

The Irreverent Reverend
Local time
Today, 10:27
Joined
Jul 23, 2001
Messages
279
Zero-Width Field

See, and I tried that...

But for arguments sake, lets say I have two objects on the form.
Label#1
Txtbox#1.Visible = False

Let's say you click on Label#1 to make Txtbox#1.Visible = True
But, once you make your entry in Txtbox#1 I want it to .Visible = False

Well, 'IF' I used a button instead of a label, then sure, I could just pass the focus there...

But, call me stubborn, I prefer to use labels as buttons so that a user HAS to use their mouse to click on a button and can't tab over...

I do this because when I used buttons, too many users would tab and hit enter on the wrong button and damage data or cause problems...

Soooo, anywho...

Again, I am willing to deal with the fact that this MIGHT be an impossibility...

If not...I wanna make it happen...
 

Fornatian

Dim Person
Local time
Today, 16:27
Joined
Sep 1, 2000
Messages
1,396
Set the tabstop to No for the button if you don't want users to tab to it!:D
 

Randomblink

The Irreverent Reverend
Local time
Today, 10:27
Joined
Jul 23, 2001
Messages
279
Tabstop Tabgo

I 'THINK' I have tried that and it never worked...

MAYBE I am wrong...
But it is now my habit to run everything from labels that have an On_Click() event...

Isn't there anything else I can do...!!!!!?
 

Fornatian

Dim Person
Local time
Today, 16:27
Joined
Sep 1, 2000
Messages
1,396
The focus must be somewhere. and that somewhere must be visible

help says:

You can't move the focus to a control if its Enabled property is set to False. You must set a control's Enabled property to True (–1) before you can move the focus to that control. You can, however, move the focus to a control if its Locked property is set to True.
If a form contains controls for which the Enabled property is set to True, you can't move the focus to the form itself. You can only move the focus to controls on the form. In this case, if you try to use SetFocus to move the focus to a form, the focus is set to the control on the form that last received the focus.

Seems to me then that if all the controls on the form have the enabled property set to No then you should be able to set the focus to the form itself.

Again, a zero-width hidden behind your label textbox is a consideration
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 10:27
Joined
Feb 28, 2001
Messages
27,255
Put a locked, unbound date indicator on the form and set focus to that.
 

Randomblink

The Irreverent Reverend
Local time
Today, 10:27
Joined
Jul 23, 2001
Messages
279
Zero-Width Field for holding Focus

Tried it...

MS Access says...
Can't Move Focus to Control

Argh!

I am just going to re-think the design layout of my forms.
I have been using them as manipulatable (new word) reports.
Using combo-boxes to alter the viewed data, etc...
Ah well...

Oh, and when you set the focus to a form, it actually puts it on the first available unlocked control. So moving the focus to the form just drops it back to the field I am trying to make invisible.

Nice try tho...
Great ideas, I will just re-work my forms and make sure I have a form footer/header with something manipulatable...

signing out...
(...and making up words as I go...)
 

Users who are viewing this thread

Top Bottom