Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    mwr is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Feb 2014
    Location
    San Francisco Bay Area
    Posts
    9

    One more... Programmed Access 2003 app blows up on Windows 7


    I have a long-running application in Access 2003 that ran fine on Windows XP. It has lots of code and data references. I just moved to a Windows 7 Home Premium computer (64 bit), installed Access 2003 and the app mdb files.

    1. Access 2003 runs fine for simple use (no code), just queries and reports.

    2. My programmed app blows up. Here are two errors that occur in this sequence:

    - Run-time error '70': Permission denied - The line of code:
    SendKeys "{F4}"

    - [a programmed error message saying that a variable contained improper contents]

    The SendKeys "{F4}" is used to pop-up a menu.

    Any ideas?

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,847
    For error 70 this may help -- I think win 7 needs to be told you can write to this file (or similar)
    see http://msdn.microsoft.com/en-us/libr...=vs.60%29.aspx
    Good luck

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I Googled "vba sendkeys not working in windows 7" and there is a lot of posts. Most are about Excel.... but the general gist is that if UAC is enabled, the use of Sendkeys is a problem. Most solution involve re-writing the code to not use Sendkeys.

    For one post, see: http://forums.devx.com/showthread.ph...DOWS-7-STARTER

  4. #4
    mwr is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Feb 2014
    Location
    San Francisco Bay Area
    Posts
    9
    >For error 70 this may help -- I think win 7 needs to be told you can write to this file (or similar)
    see http://msdn.microsoft.com/en-us/libr...=vs.60%29.aspx<

    Thanks, but I didn't see anything there that seemed to apply. I don't think SendKeys writes to a file.
    Last edited by mwr; 02-13-2014 at 12:12 PM. Reason: clarity

  5. #5
    mwr is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Feb 2014
    Location
    San Francisco Bay Area
    Posts
    9
    Thanks, Steve, for that thread. I'm seeing if I can implement any of the methods there to replace SendKeys.

  6. #6
    mwr is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Feb 2014
    Location
    San Francisco Bay Area
    Posts
    9
    I tried adding the code given at the top of the page here - http://vb.mvps.org/samples/SendInput - But in debugging/compiling it said: Compile error: Variable not defined (the variable was "Text1"). The code is below:
    --------------------
    Private Sub Command1_Click()
    Text1.SetFocus
    Call MySendKeys(Text2.Text)
    DoEvents
    Command1.SetFocus
    End Sub

    Private Sub Command2_Click()
    Text1.SetFocus
    Call VBA.SendKeys(Text2.Text)
    DoEvents
    Command2.SetFocus
    End Sub

    Private Sub Form_Load()
    Text2.Text = "{home}+{end}Testing123+(123)"
    End Sub
    --------------------

    Note that I wrote this app, but haven't written a line of code in over 10 years so I'm very rusty. Where/how should variable Text1 and (presumably) Text2 be defined?

  7. #7
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    The code doesn't make sense to me.
    I am totally confused on what you are trying to do.

    The best thing to do is rewrite all of the Sendkeys commands to VBA (if possible).

    But here is a Sendkeys replacement by Dev Ashish that makes more sense to me:
    http://access.mvps.org/access/api/api0046.htm

  8. #8
    ipisors is offline Access Developer
    Windows XP Access 2007
    Join Date
    Sep 2013
    Posts
    119
    I'd like to clarify a few things - what little is clear from this thread.

    1. Sendkeys does not write to a file, nor would it by itself invoke any Permission Denied error. The next obvious thing to check is WHAT is sendkeys F4 doing? You say it's opening a popup form. So look into ALL CODE connected with that pop up form - like Load, Open and Current events. Learn how to debug by researching which Access Form event fires first, then put a break point on the first line of code in that event. Step through the code line by line until you realize which item is the problem. Remove or comment out any error handlers (like On Error GoTo SomeErrorHandlerLabel) so that it will debug instead of just bombing. After removing all error handlers, make sure to open the database with accdb or mdb, not accdr or accde or mde, so that you can properly debug.

    2. As a totally separate discussion (not as a solution to this problem, nor a replacement for the need to figure out what is causing this), do not use Sendkeys at all. It is unreliable and a bad practice.

    Research will be required on your end to troubleshoot this.

  9. #9
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    I have found it dificult to intercept the function keys in newer versions of Access. Maybe use a different key combination like Alt+T or something.

  10. #10
    mwr is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Feb 2014
    Location
    San Francisco Bay Area
    Posts
    9
    Quote Originally Posted by ssanfu View Post
    The code doesn't make sense to me.
    I am totally confused on what you are trying to do.

    The best thing to do is rewrite all of the Sendkeys commands to VBA (if possible).

    But here is a Sendkeys replacement by Dev Ashish that makes more sense to me:
    http://access.mvps.org/access/api/api0046.htm
    Thanks, ssanfu. I added that code to my Access 2003 app and got a compile error on the "Private" declaration following "End Type". The error message was - Compile error: Only comments may appear after End Sub, End Function, or End Property.

  11. #11
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Attached is an A2K dB with a module that contains the code. Open your dB, then import the module (File>Get External Data> Import).
    See if this works....

  12. #12
    mwr is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Feb 2014
    Location
    San Francisco Bay Area
    Posts
    9
    Quote Originally Posted by ssanfu View Post
    Attached is an A2K dB with a module that contains the code. Open your dB, then import the module (File>Get External Data> Import).
    See if this works....
    Thanks once more, ssanafu. I did that and replaced the offending - SendKeys "{F4}" - with - mySendKeys "{F4}". However, the code you sent contains - Sub mySendKeys - which contains - SendKeys sKeys, bWait - which produced the same - Run-time error '70': Permission denied.

    Am I missing something here?

  13. #13
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I was just trying to help out with the replacement function. I do not and have not ever used sendkeys......

    Is there a reason you cannot convert the sendkeys command to VBA? What does SendKeys "{F4}" do?

    Is it possible for you to post the snippet of code that has the sendkeys statement?

  14. #14
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,847
    If you look at Isaac's post #8, he's saying that SendKeys would not Write by itself. So, it must be somewhere else.
    Is there other parts in your code where you are actually writing to a file, or even trying to read a file that may be protected?

    Maybe we should be looking at your database.

  15. #15
    mwr is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Feb 2014
    Location
    San Francisco Bay Area
    Posts
    9
    >What does SendKeys "{F4}" do?<

    Acts as if the user pressed the F4 key, which pops up/down the combo box menu (combo box has the focus).

    >Is it possible for you to post the snippet of code that has the sendkeys statement?<

    ' Here's an example of using SendKeys "inline" in the code:
    If KeyCode = KEY_ENTER Then
    SendKeys "{F4}" ' Pop up/down the Option Group list
    End If

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 09-06-2012, 12:56 PM
  2. Replies: 6
    Last Post: 06-02-2011, 12:27 PM
  3. Windows 7 and smtp mail with Access 2003
    By mafhobb in forum Programming
    Replies: 1
    Last Post: 06-28-2010, 09:05 AM
  4. Access 2003 and Windows 7
    By icedude in forum Access
    Replies: 4
    Last Post: 02-03-2010, 03:18 PM
  5. Replies: 0
    Last Post: 12-13-2009, 05:15 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums