Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

MS Access Send Keys {PGDN} alternative

Posted on 2014-01-07
6
Medium Priority
?
408 Views
Last Modified: 2014-01-22
So, I know I'm not supposed to use send keys, but I don't know how to do this any other way.  I now need to as the send keys {PGDN} does not work on my WIn 8 tablet.

I have a selection list "List1"

I want two big buttons for page up and page down as the guys in the field won't be able to use the little sliders to navigate up and down.

Is there an alternative to this:

Me.List1.setfocus
sendkeys "{PGDN}"

Thanks
0
Comment
Question by:hgj1357
[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
  • 3
  • 2
6 Comments
 
LVL 17

Expert Comment

by:Kent Dyer
ID: 39763793
How about doing this programatically?

SELECT * FROM SOMETABLE WHERE column = "some_value"
0
 
LVL 2

Author Comment

by:hgj1357
ID: 39763799
The list has >1,000 items in it, so this would be a laborious approach. ALthough I suppose we could go

Field1 = Me.ID
Me.ID = Field1 + 10
Field1 = Me.ID
0
 
LVL 29

Accepted Solution

by:
IrogSinta earned 2000 total points
ID: 39764026
Well you could do something like this:
Me.List1 = Me.List1.ItemData(Me.List1.ListIndex + 10)
But this has some problems; one is that there would be a highlighted item when the button is pressed.  The other problem is that the scrollbar would still be visible and if that is used it would throw off the next visible section of the list.  

You are probably better off creating a subform that resembles a listbox -- that way you could hide the scrollbar.  Here's some code you could use (you would need to change NameOfSubformControl and update the iSkip constant to suit your purpose):
Private Sub btnScrollDown_Click()
'   Scroll Down
    Const iSkip As Integer = 10
    
    With Me.NameOfSubformControl.Form.RecordsetClone
        If .AbsolutePosition = -1 Then .Move 1
        
        .Move iSkip
        Me.NameOfSubformControl.Form.Bookmark = .Bookmark
        
        If .AbsolutePosition > 0 Then
            Me.btnScrollUp.Enabled = True
            Me.ArrowsPrev.Visible = True
        End If
        If .RecordCount - .AbsolutePosition < (iSkip + 1) Then
            Me.btnScrollUp.SetFocus
            Me.btnScrollDown.Enabled = False
        End If
    End With
    
    
End Sub

Private Sub btnScrollUp_Click()
'   Scroll Up
    Const iSkip As Integer = 10
    
    With Me.NameOfSubformControl.Form.RecordsetClone
        .Move -iSkip
        
        Me.NameOfSubformControl.Form.Bookmark = .Bookmark
        If .RecordCount - .AbsolutePosition > iSkip Then
            Me.btnScrollDown.Enabled = True
        End If
        If .AbsolutePosition = 0 Then
            Me.btnScrollDown.SetFocus
            Me.btnScrollUp.Enabled = False
        End If
    End With
    
End Sub

Open in new window

Ron
0
Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

 
LVL 2

Author Comment

by:hgj1357
ID: 39801018
I ended up using this. It works surprisingly well.

Dim MyList As Integer
MyList = Me.List1.ListIndex
MyList = MyList + 12
Me.List1.SetFocus
Me.List1.ListIndex = MyList

12 is the number of items shown in the list, i.e. one page.
0
 
LVL 29

Expert Comment

by:IrogSinta
ID: 39801070
Well, you really could shorten what you have to the following two lines:
Me.List1.SetFocus
Me.List1.ListIndex = MyList.ListIndex + 12

Open in new window

Or you could have used the single line I gave you earlier.  That way you wouldn't have needed to SetFocus to the listbox first:
Me.List1 = Me.List1.ItemData(Me.List1.ListIndex + 12)

Open in new window

In either case, you will still have the problems I pointed out earlier:
1. there would be a highlighted item when the button is pressed.
2. the scrollbar would still be visible and if that is used it would throw off the next visible section of the list.

Ron
0
 
LVL 2

Author Comment

by:hgj1357
ID: 39801101
I can live with those issues.  I have bigger ones!!
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

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

Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …

670 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