Results 1 to 3 of 3
  1. #1
    bonecone is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2012
    Posts
    25

    Question dynamically setting the KeyDown event for all textboxes

    My users are able to toggle between form view and datasheet view. I don't want them to be able to edit data when they are in datasheet view, so I have coded the onload event of the datasheet form with



    Code:
        Dim ctl As Control
        
        For Each ctl In Me
            If ctl.ControlType = acTextBox Then
                ctl.OnKeyDown = "=HandleKeyDown()"
            End If
        Next ctl
    The problem is I don't know what I need to put into the HandleKeyDown function in order to force the textboxes to ignore keyboard input.

  2. #2
    bonecone is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2012
    Posts
    25
    I found a different solution afterwords. I just set the Locked property of all the textboxes to "Yes".

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You could also have set the allow edits property of the form.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. navigate between forms dynamically
    By rohini in forum Forms
    Replies: 17
    Last Post: 03-10-2012, 12:47 PM
  2. Setting crosstab headings dynamically
    By dougie in forum Queries
    Replies: 3
    Last Post: 01-18-2012, 12:47 PM
  3. Replies: 2
    Last Post: 09-21-2011, 07:23 AM
  4. Keydown and SendKeys
    By Remster in forum Programming
    Replies: 10
    Last Post: 08-10-2011, 10:39 AM
  5. Replies: 11
    Last Post: 07-27-2011, 05:51 PM

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