Are my brackets too curly?

R

royfarnol

I want to send keys {PGUP} and {PGDN} but 2007 tells me my brackets are
"invalid". I pasted them from HELP too.

I must be doing something wrong I suppose.

Please advise. Roy.

p.s. Is there another way of invoking page up and page down?
 
R

royfarnol

Thanks for your advice, Wayne.

All I want to do is supply a couple of buttons for page up and page down
instead of using vertical scrollbars on a heavily populated continuous form.

If I recall correctly Access97 asked for "{PgUp}" while 2007 in HELP asks
for no quotes.

Much opbliged, Roy.
 
W

Wayne-I-M

If you are on a continous form - ie you want to go to the next or the
previous record you could use
DoCmd.GoToRecord , , acPrevious
or
acNext

Don't know what you're trying to do but it could be used something like this

Private Sub ButtonName_Click()
On Error GoTo Err_ButtonName_Click
DoCmd.GoToRecord , , acPrevious
Exit_ButtonName_Click:
Exit Sub
Err_ButtonName_Click:
MsgBox "This is the first record", vbOKOnly, "Stop pressing the button"
Resume Exit_ButtonName_Click
End Sub

or

Private Sub ButtonName_Click()
On Error GoTo Err_ButtonName_Click
DoCmd.GoToRecord , , acNext
Exit_ButtonName_Click:
Exit Sub
Err_ButtonName_Click:
MsgBox "This is the last record", vbOKOnly, "Stop pressing the button"
Resume Exit_ButtonName_Click
End Sub

Why do you want to press the buttons using code - ???
What tye of form is it - ???
 
R

royfarnol

The situation is that I have a very long continuous form which I want to
page up and page down looking for stuff but, simply, I don't like using the
scroll bar which is either too slow or too fast for my purposes.
A quick browse of a pageful serves me well with the added attraction that if
I want to compare back I can easily rember that I've paged up or down a
specific number of times.
SendKeys "{PGUP}" is what I have used in the past and is what I'd like to
use again.
In your code is there room for a "DoCmd.Go up a page" or similar?
Thanks, Roy.
 
J

John W. Vinson

The situation is that I have a very long continuous form which I want to
page up and page down looking for stuff but, simply, I don't like using the
scroll bar which is either too slow or too fast for my purposes.
A quick browse of a pageful serves me well with the added attraction that if
I want to compare back I can easily rember that I've paged up or down a
specific number of times.
SendKeys "{PGUP}" is what I have used in the past and is what I'd like to
use again.

As noted elsethread, I'd really suggest avoiding Sendkeys for *anything*. It's
just too buggy, and MS has quit supporting it.

How about figuring out how many lines in a "page" (probably manually) and go
ahead that many lines. This is sort of ugly and inefficient, but I tried it
and it seems to work:

Private Sub cmdPageDown_Click()
On Error GoTo Err_cmdPageDown_Click
Dim nPos As Integer, nMax As Integer
Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
rs.Bookmark = Me.Bookmark ' where are we now?
nPos = rs.AbsolutePosition + 5 ' "page" down 5 rows
rs.MoveLast ' be sure the recordset is fully scanned
nMax = rs.RecordCount ' find the last row of the subform
If nPos > nMax Then nPos = nMax

DoCmd.GoToRecord , , acGoTo, nPos ' go down 5 rows
' or to the end of the form, whichever

Exit_cmdPageDown_Click:
Exit Sub

Err_cmdPageDown_Click:
MsgBox Err.Description
Resume Exit_cmdPageDown_Click

End Sub
 
T

Tony Toews [MVP]

royfarnol said:
The situation is that I have a very long continuous form which I want to
page up and page down looking for stuff

I would suggest some filtering fields at the top of the form.

I think Filter By Form Example for Run-Time Applications Available in
the Download Q166634. http://support.microsoft.com/kb/166634 is what
I mean although I didn't download it to take a look.

For an example of the filtering I put in my apps see
http://www.granitefleet.com/ScreenShots/screen_EquipmentQuickFind.htm

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
R

royfarnol

Thanks to a trio of MVPs for their help. I'll try all the suggestions given.

Thanks, Roy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top