?
Solved

On the use of "SendKeys"

Posted on 2001-09-18
10
Medium Priority
?
506 Views
Last Modified: 2012-08-14
Hi !
In an app I use SendKeys quite often to automate
som othervise manual operations.
There is however one place where it seems that this method
is difficult, namely in the opening screen of Access
where one has Tables, Queries, Forms etc.
Are these tabs adressable by SendKeys ?
I see no undescores in the folder-names.

Jan
0
Comment
Question by:skyberg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 6490194
Hi skyberg,

So maybe you need to call that particular Sub as:

Call Command1_Click()
0
 
LVL 4

Expert Comment

by:maatthias
ID: 6490255
They are indeed addressable.  Once an object (table, query etc.) is selected, Shift + Tab highlights the object name.  Then, left or right arrows get you where you need to go.

Take this for what it's worth, but I've never been hot on using SendKeys.  Pretty much anything you need to do is better handled with proper form VBA code and Jet SQL.  But then there ya go.

Best.
0
 
LVL 6

Expert Comment

by:cjswimmer
ID: 6490372
use DoCmd.SelectObject and set the last parameter to True to have the object selected in the database window.  Here are the specifics (from the help file)

DoCmd.SelectObject objecttype[, objectname][, indatabasewindow]

objecttype
One of the following intrinsic constants:
   acForm
   acMacro
   acModule
   acQuery
   acReport
   acTable
Note - The constant acDefault, which appears in the Auto List Members list for this argument, is invalid for this argument. You must choose one of the constants listed above.

objectname
A string expression that's the valid name of an object of the type selected by the objecttype argument. This is a required argument, unless you specify True (?1) for the indatabasewindow argument. If you specify True for the indatabasewindow argument and leave the objectname argument blank, Microsoft Access selects the tab in the Database window that corresponds to the database object you specify in the objecttype argument.

indatabasewindow
Use True to select the object in the Database window. Use False (0) to select an object that's already open. If you leave this argument blank, the default (False) is assumed.

Remarks
If you set the indatabasewindow argument to True and leave the objectname argument blank, you must include the objectname argument's comma. If you leave a trailing argument blank, don't use a comma following the last argument you specify.


hope this helps - cjswimmer
0
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 
LVL 54

Expert Comment

by:nico5038
ID: 6490462
Hi skiberg,

Just a warning: to try to minimize on Sendkey's as it's directed to the active window. When the window-focus is shifted to another application, your keystrokes are "lost"!

The "cjswimmer" approach is superior as it will work in all cases !

Nic;o)
0
 

Author Comment

by:skyberg
ID: 6490590
Using "DoCmd.SelectObject" sounds tempting in the case
where one knows the name of the objects.
In the case of tables, one can "Mark all" by "SendKeys".

In my case I am about to convert a number of (min 20) data-
bases.

By running in a loop, all the bases could easily be
converted in the case of tables.
The other objects seem not to be that easy.
As far I can see, one has to go into the interior of
the bases in order to get hold of the differentb objects.
I had hoped to avoid just that.

I will return with an asessment.

Jan
0
 
LVL 6

Accepted Solution

by:
cjswimmer earned 150 total points
ID: 6490639
I'm not sure what you mean by 'converting' the databases.  You can also access all of these objects in their collections

CurrentDB.Tabledefs
CurrentDB.Querydefs
CurrentDB.Containers!Forms
CurrentDB.Containers!Reports
CurrentDB.Containers!Modules
CurrentDB.Containers!Scripts  '(Macros)
0
 

Author Comment

by:skyberg
ID: 6492775
Mr cjswimmer!
By convert I mean transfering objects from say a -97
version to an empty (new) -2000 version app.
When I've got a job of converting quite a number of apps,
I am very tempted to do that in an automated manner
(if possible). I have made a tool for just that.
But as You point out, it may be neccesary to go into
the interior of the bases, adressing the different objects
just the way You describe above.
Unless I find a better way, I may do just that.

I'll be back with a conclusion in a few days.

Jan
0
 
LVL 6

Expert Comment

by:cjswimmer
ID: 6493305
If you open an Access 97 database with Access 2000, you will prompted to have the database converted automatically for you.  While this technique is not always error-free, it does save a tremendous amount of work and there are articles available on what situations can occur when you have Access do the conversion for you.

0
 

Author Comment

by:skyberg
ID: 6493734
Yes, I know that.
Using that technique, it sure is best to do it manually.
There is however another approach to the problem; namely
1) Start Access v-2000 creating an empty base.
2) Importing objects from the -97 base.
3) Manually checking for errors in References (compile).

Doing it this way, I have automated the prosess of
at least importing the table-objects.
In the case at hand, the bases are very simple, with no
relationships and all in one file.
The problem is; the number of files.
Of couse there may be permission-problems which will be
seen on the screenm during the batch-run.

Jan
0
 

Author Comment

by:skyberg
ID: 6505513
Hi mr cjswimmer !
Here are Your points for giving the best info.

Jan
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question