Trapping Edit Mode !

P

Prakash

I have a "continuous" form for which I've set up a key handler to
prevent the cursor from rolling into the 1st left-most column as
follows:

Private Sub Unit_Id_KeyDown(KeyCode As Integer, Shift As Integer)
' This being the Left-Most column stop cursor from Rolling to the
LAST column
If KeyCode = vbKeyLeft Then
KeyCode = 0
Beep
End If

End Sub


This works fine as long as the user has not clicked within the Unit_Id
field i.e. (it is fully selected in dark color). If however the user
has clicked with the Unit_Id field or pressed F2 to edit it, then also
the left-arrow key is blocked & beeps.

What I'd like is:
a) If in EDIT mode the left arrow should scroll & work within the
field and ...
b) if in selected mode, the left arrow should get trapped & beep. Any
ideas ??

Rgds,
Prakash.
 
G

Gloops

Prakash wrote, on 11th Apr. 2012 22:16 UTC + 1 :
What I'd like is:
a) If in EDIT mode the left arrow should scroll& work within the
field and ...
b) if in selected mode, the left arrow should get trapped& beep. Any
ideas ??

Rgds,
Prakash.

Hello,

Maybe testing Unit_id.SelLength could help you, although I do not
exactly realize your aim.


You can enter the edit mode automatically on that field that way :

Private Sub Unit_id_GotFocus()
Unit_id.SelLength = 0
Unit_id.SelStart = Len(Unit_id)
End Sub


This presumes that Unit_id is a text field, otherwise you could try
something like Len(Str(Unit_id)), or perhaps Len(Str(Unit_id) - 1).
 
G

Gloops

Gloops wrote, on 12th Apr. 2012 01:41 UTC + 1 :
You can enter the edit mode automatically on that field that way :
(...)

By the way, do not forget to initiate correctly the Cycle property of
the form, otherwise, in selected mode, the left key could send you to
the previous record, as well as Shift Tab.
 
P

Prakash

Gloops wrote, on 12th Apr. 2012 01:41 UTC + 1 :


By the way, do not forget to initiate correctly the Cycle property of
the form, otherwise, in selected mode, the left key could send you to
the previous record, as well as Shift Tab.

Thx Gloops!! The cycle property was already taken care of.
Nevertheless, thx again for the Caveat :)

I'm on this group after many years. Is this group active or are there
any other active Access NG's ?

Rgds,
Prakash.
 
P

Prakash

Prakash wrote, on 11th Apr. 2012 22:16 UTC + 1 :



Hello,

Maybe testing Unit_id.SelLength could help you, although I do not
exactly realize your aim.

You can enter the edit mode automatically on that field that way :

Private Sub Unit_id_GotFocus()
Unit_id.SelLength = 0
Unit_id.SelStart = Len(Unit_id)
End Sub

This presumes that Unit_id is a text field, otherwise you could try
something like Len(Str(Unit_id)), or perhaps Len(Str(Unit_id) - 1).

The Unit_id.SelLength property helped bro. Gracias :)
 
J

John W. Vinson

I'm on this group after many years. Is this group active or are there
any other active Access NG's ?

Microsoft is no longer hosting these USENET newsgroups, but a USENET newsgroup
is like an undead vampire - it's effectively immortal. The group started on
Microsoft's servers, but has since propagated to tens of thousands of servers
all over the world, and very few servers will honor calls to cancel a
newsgroup (there have been far too many forged cancels, issued out of malice).

Microsoft went to a (far less satisfactory, IMO) web-based method of providing
a mix of volunteer and company-staffed support. See my .sig for some links
specifically for Access.
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 
T

Tony Toews

I'm on this group after many years. Is this group active or are there
any other active Access NG's ?

Still active. There are quite a number of long time regulars who
still visit these newsgroups regularly.

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/
 
T

Tony Toews

Microsoft is no longer hosting these USENET newsgroups, but a USENET newsgroup
is like an undead vampire - it's effectively immortal.

Hmm, undead vampire isn't the metaphor I would've used. <smile>
Hows about that 10 square mile mold in some forest somewhere? Nah,
not a good image either. I have a vague memory of some trees being
very connected via the root system.

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/
 
J

John W. Vinson

Hmm, undead vampire isn't the metaphor I would've used. <smile>
Hows about that 10 square mile mold in some forest somewhere? Nah,
not a good image either. I have a vague memory of some trees being
very connected via the root system.

Tony

My wife once worked in that very forest (near Crystal Falls, Michigan), and
had a sweatshirt - now long sent to the ragbag - with a big logo "There's a
humungous fungus among us". <g>

And yes, if you look from a distance at a forest containing aspen groves,
you'll see that the aspens grow in patches, and that all the trees in a patch
change color at the same time. A hectare patch of hundreds of trees may well
be one interconnected organism, and may be thousands of years old (even if
each individual tree only lives a few dozen years).
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 
G

Gloops

Prakash wrote, on 12th Apr. 2012 11:26 UTC + 1 :
I'm on this group after many years. Is this group active or are there
any other active Access NG's ?

You are connected via Google ?
Hum, that would be a strange thing to learn, that Google is unable to
tell you what newsgroups exist with Access in their name ...

I am connected with Thunderbird, and with that, for each server I can
see the list of existing newsgroups, and filter it with a text, for
instance "access". That could answer your question, you can see that
there are a certain number of subgroups, specialized into different
aspects. For instance you have one for reports.

After that you have one group per language, for example I often go to
the French one, microsoft.public.fr.access
 
T

Tony Toews

My wife once worked in that very forest (near Crystal Falls, Michigan), and
had a sweatshirt - now long sent to the ragbag - with a big logo "There's a
humungous fungus among us". <g>

I recall talking to a 3 year old about them going to the docks in
Vancouver. "The ships were humungous" with a lot of excitement in her
voice.
And yes, if you look from a distance at a forest containing aspen groves,
you'll see that the aspens grow in patches, and that all the trees in a patch
change color at the same time. A hectare patch of hundreds of trees may well
be one interconnected organism, and may be thousands of years old (even if
each individual tree only lives a few dozen years).

Ahh, I never knew that. But then I don't know if there's much aspen
around here in Alberta.

Ton
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top