Macros and "SendKeys" type functionality in Access 2007?

Answered Macros and "SendKeys" type functionality in Access 2007?

  • Friday, February 11, 2011 8:34 PM
     
     

    Hello,

    I had a macro built in Access 2003 using the "SendKeys' action....using shortcut keys to import data.  2007 no longer uses SendKeys.

    Does anyone know if Access 2007 has a different way of doing this in a macro?

    Thank you!
    MN

All Replies

  • Friday, February 11, 2011 9:13 PM
     
     
    "MacNut" wrote in message
    news:44260520-1791-4a97-94e0-ff2e91a99fb9@communitybridge.codeplex.com...
    > Hello,
    >
    > I had a macro built in Access 2003 using the "SendKeys' action....using
    > shortcut keys to import data.  2007 no longer uses SendKeys.
    >
    > Does anyone know if Access 2007 has a different way of doing this in a
    > macro?
    >
    That depends on what you were using SendKeys for.  There's not much you
    might use SendKeys for that couldn't be done some other way -- manipulating
    some other application, which doesn't support automation, is about it.
     
    If you really need to, you can call a Windows API function to push a key
    into the queue.  But I've never needed to do that.
     
    What are you doing with SendKeys?  Maybe we can suggest a good alternative.
     
     

    Dirk Goldgar, MS Access MVP
    Access tips: www.datagnostics.com/tips.html
  • Friday, February 11, 2011 9:20 PM
     
     

    Hi!

    Thanks for your response.  What I was doing with SendKeys was opening up the import window for the user to import a file into Access from excel.

    Do you know of an alternative way of doing that ?

    Thank you!
    MN

  • Friday, February 11, 2011 9:57 PM
     
     Answered
    "MacNut" wrote in message
    news:dba11bc5-c24d-44fb-b28b-a2981f0c1dc7@communitybridge.codeplex.com...
    >
    > Thanks for your response.  What I was doing with SendKeys was opening up
    > the import window for the user to import a file into Access from excel.
    >
    > Do you know of an alternative way of doing that ?
     
    >
     
    Do you mean like this?
    '
       RunCommand acCmdImport
    '
    Although usually if I want to import specifically an Excel file, I'll
    display a File Open dialog to get the user to choose the file, then use
    DoCmd.TransferSpreadsheet to import the file.  That way, the user has few
    decisions to make.
     
     

    Dirk Goldgar, MS Access MVP
    Access tips: www.datagnostics.com/tips.html
  • Friday, February 11, 2011 10:30 PM
     
     

    That sounds like a good technique!

    Is there a way this can all go in a macro, and if so, what would i put in the macro?

    Thank you!

    MN

  • Friday, February 11, 2011 11:51 PM
     
     

    Actually, I just went into my macro and used the "RunCommand" like you suggested, and used the ImportSpreadsheet in the action part of the command.  Works great and is what i needed!

    Thank you!

    MN

  • Saturday, February 12, 2011 3:35 AM
     
     
    "MacNut" wrote in message news:44260520-1791-4a97-94e0-ff2e91a99fb9@communitybridge.codeplex.com...

    Hello,

    I had a macro built in Access 2003 using the "SendKeys' action....using shortcut keys to import data.  2007 no longer uses SendKeys.

    Does anyone know if Access 2007 has a different way of doing this in a macro?

    Thank you!
    MN

    The sendkeys command was not removed. You have to enable those commands by clicking on the icon that show all actions.
     
    eg:
     
     
     
     
    So, you can use sendkeys, but as a general rule a risky and unreliable approach.
     
    --
    Albert D. Kallal (Access MVP)
    Edmonton, Alberta Canada
    Pleasenospam_kallal@msn.com
  • Thursday, May 31, 2012 2:56 PM
     
     

    Hi all,

    I was just upgraded to Access 2007 at work and I am having problems with SendKeys I had set up in 2003.  I am using the SendKeys to open a table, insert a new column and set it as an autonumber field.  I tried enabling those actions by clicking the icon "show all actions".  It looks like you are in macro tools and I don't know how to get to that.  Help?

    Thanks!

  • Thursday, May 31, 2012 5:33 PM
     
     

    I was just upgraded to Access 2007 at work and I am having problems with SendKeys I had set up in 2003.  I am using the SendKeys to open a table, insert a new column and set it as an autonumber field.  I tried enabling those actions by clicking the icon "show all actions".  It looks like you are in macro tools and I don't know how to get to that.  Help?

    If I understand you properly, I don't think I would be using SendKeys for such a thing, anyway.  However, to advise you I need to know what constraints you're operating under.  Can you use VBA in this database, or does it have to be macros?  If it's a web database, it has to be macros, but otherwise you have the option of using VBA, and I can do it in VBA without having to look anything up.


    Dirk Goldgar, MS Access MVP
    Access tips: www.datagnostics.com/tips.html

  • Friday, June 01, 2012 1:03 PM
     
     

    I know how to get to the VB editor but I have never performed any VB programming in Access or otherwise but I am familiar with programming language enough to have an OK understanding of what you tell me.  It is not a web database and any assistance you can offer is greatly appreciated.

    Regards,  Nicole


    Nicole

  • Friday, June 01, 2012 4:28 PM
     
     

    I know how to get to the VB editor but I have never performed any VB programming in Access or otherwise but I am familiar with programming language enough to have an OK understanding of what you tell me.  It is not a web database and any assistance you can offer is greatly appreciated.

    I'd be glad to help.  First I need the answers to a few questions.

    1. Is this to be done to a particular table? 

    2. If so, what is the name of the table? 

    3. If not, how should the procedure get the name of the table to be modified?

    4. What is the name of the autonumber field to be added?

    5. Should the new field be indexed? If so, should it be made the table's primary key? If so, can we assume the table has no existing primary key, or do we have to replace an existing primary key?

    6. What event will be used to trigger this procedure to add the column?  Would the user click on a command button, would it be called from a macro, or what?  If it's to be run from a command button, what would be the name of the button?

    7. Since you say you have an existing macro that used to do this, could you please detail the actions (and their arguments) of that macro?  That would help me check my understanding of what you need the new procedure to do.


    Dirk Goldgar, MS Access MVP
    Access tips: www.datagnostics.com/tips.html

  • Friday, June 01, 2012 6:24 PM
     
     

    I think you need to take a step back and look at the design of your database. It should be VERY rarely necessary to change the internal structure of a table "on the fly" under user control, much less adding something basic like an autonumber field!

    What real-life job related task is this macro intended to accomplish? I'm virtually certain that there must be a better way.


    John W. Vinson/MVP