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

Highlight Field on Click for Editing (F2)

I have an Access 97 database that when converted to Access 2007 everything seems to work except for the Send Keys function. I have a sendkeys function on the on-click action in a form that sends F2 which highlights the entire field so that it can be completely overwritten as opposed to the normal behavior of just inserting a cursor for editing. Is there a work around for this?

Thanks,

Rob
Sep 21 '07 #1
10 6689
Scott Price
1,384 Expert 1GB
Good morning, and welcome to the Scripts!

Converting from Access 97 to 2007 isn't a task for the faint of heart :-)

Allen Browne's website here Acesss Tips: Converting to Access 2007 is an excellent resource including links to other very good resources.

That said, I'm not sure about the send-keys function, but I believe I've seen a thread on that somewhere here. Let me take a look and get back to you.

Regards,
Scott
Sep 21 '07 #2
Scott Price
1,384 Expert 1GB
This is a link to MS website with a discussion of Access 2007 sandbox mode. Apparently the sandbox mode will restrict the availability of a number of functions, among which is SendKeys. It will result in an error when called from VBA. http://office.microsoft.com/en-us/ac...301901033.aspx

As far as a solution, that depends on your application. One developer's advise is to always develop your applications for the maximum level of security restrictions that will be imposed by Access: in other words don't look for a way to make it work by lessening the restrictions, look for a way to re-design so as to not infringe the security imposed by sandbox mode.

That said, again depending on your application requirements, you could explore resetting the sandbox mode to a lower level to see if that will allow the SendKeys to work.

Regards,
Scott
Sep 21 '07 #3
Thanks for the reply....,well let's forget about security and sandbox rules. What if I was writing a brand spanking new DB in Access 2007? How do I accomplish the following. I have a Order Entry Form with certain text box fields that when clicked I want to completely highlight, so a single keystroke will erase the the existing data enabling to input new data. It is what hitting F2 will do, but I don't want the user to have to hit F2. As opposed to do the default of clicking the text box field and the insert cursor blinking at the point of click. Maybe a "Select all" function? How do I program this under the "OnCLick" function?

Thanks,

Rob
Sep 22 '07 #4
Scott Price
1,384 Expert 1GB
Thanks for the reply....,well let's forget about security and sandbox rules. What if I was writing a brand spanking new DB in Access 2007? How do I accomplish the following. I have a Order Entry Form with certain text box fields that when clicked I want to completely highlight, so a single keystroke will erase the the existing data enabling to input new data. It is what hitting F2 will do, but I don't want the user to have to hit F2. As opposed to do the default of clicking the text box field and the insert cursor blinking at the point of click. Maybe a "Select all" function? How do I program this under the "OnCLick" function?

Thanks,

Rob
This code works fine in the On Click event of a text box in Access 2003. Give it a try:
Expand|Select|Wrap|Line Numbers
  1.     Me!Text1.SelStart = 0
  2.     Me!Text1.SelLength = Len(Me!Text1.Text)
You'll need to rename Text1 to the name of your text box.

Regards,
Scott
Sep 22 '07 #5
NeoPa
32,556 Expert Mod 16PB
Alternatively try :
Tools / Options / Keyboard / Behavior entering field ==> Select entire field.
This is a per PC (installation of Access) approach mind you, but may be easiest. It may even be possible to force using code within a database but I don't know the code if it is.
Sep 22 '07 #6
Thanks for the responses, I'll the try the SelLength code tomorrow. I appreciate the other response regarding the setting per pc, I knew about that, but I don't want the behavior on all fields.

Thanks,

Rob
Sep 26 '07 #7
Randoz
27
This works great for text box, but shouldn't it work for a combo box as well. I can't seem to get it to work on a combo box.

Randy
Dec 14 '07 #8
missinglinq
3,532 Expert 2GB
Why would you want to select the text in a combobox?

Linq ;0)>
Dec 14 '07 #9
NeoPa
32,556 Expert Mod 16PB
This works great for text box, but shouldn't it work for a combo box as well. I can't seem to get it to work on a combo box.

Randy
It shouldn't, no.
It would make little sense for it to work that way in a ComboBox.
Dec 14 '07 #10
Randoz
27
I have a combo box set up to either select from existing text or add new text.
Dec 14 '07 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: john woo | last post by:
Hi I'm not good at JS, but want to get more about it. I want to use a JSP (the java code just used to get date, the rest are html and javascript), to display a table. the requirement is the...
6
by: Dirk Van de moortel | last post by:
Hi, We have a database with some tables with (what I would denote as) 'referred field names'. Like this: DataTable1 with fields F1, F2, F3 DataTable2 with fields F3, F4, F5 DataTable3 with...
1
by: Not Me | last post by:
Hey, In our database, we have implemented auditing simply by holding a copy of each row of the specific table at any time that data is updated. This gives us a long list of full records, often...
0
by: strauss.sean | last post by:
To all: I have a question: I have a form whose Default View is Continuous Forms. When I select a field (F3), it's backgroud higlights -- that was easy, using conditional formatting. What I...
2
by: Kevin | last post by:
Thanks for the very quick response posting that I can use a memo datatype to store large amounts of text. I understand that I can turn on "Can Grow" for a memo type, but is there either a...
0
Merlin1857
by: Merlin1857 | last post by:
A thing I have been asked for on a number of occasions is the ability to highlight text after its been searched for in a record return page. The following does this perfectly. Use this function...
1
by: nafise | last post by:
Hi, I have a problem in calculating a field in a table. I have 2 tables with these fields: 1- examcode , p1, p2, P 2- examcode, f1, f2 I want to update the first table to calculate the...
1
by: rishiv | last post by:
Hi, I'm using MS Access 2002 SP3 & Visual Basic 6.3 on WinXP Home SP2. I have a table of condition data (5990 records) that relates to information stored in a proprietary application. The...
6
by: =?ISO-8859-1?Q?Marcel_M=FCller?= | last post by:
Hi, is the following code valid? #include <stdio.h> struct X { bool f1:1; bool f2:1; };
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
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
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.