View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Dataform - Forward/Backward Control

Maybe something like:

Option Explicit
Sub testme()

SendKeys "%w"
Application.DisplayAlerts = False
ActiveSheet.ShowDataForm
Application.DisplayAlerts = True

End Sub

(The shortcut for a New record is alt-w (%w in Sendkeys syntax).)

or...

You can use Sendkeys to get to the row of the activecell you want.

Option Explicit
Sub testme2()

'tabs to the third field in that row
'SendKeys "{DOWN " & ActiveCell.Row - 2 & "}{TAB 3}"

'or just to the first field
SendKeys "{DOWN " & ActiveCell.Row - 2 & "}"
Application.DisplayAlerts = False
ActiveSheet.ShowDataForm
Application.DisplayAlerts = True

End Sub

Sendkeys is not a solution of choice for most things. Lots can go wrong--maybe
you won't be in excel when the macro runs, so something else will get the down's
and tabs???

Jim May wrote:

In Excel is there a way of entering controls on a form
to flip through the records of a table of data. I now
am loading the first record in the table into my form.
I just want to be able to <<using a control advance
to record 2,3,4,etc.. and 4,3,2,1
Can it be done? If so how..?
TIA,
Jim


--

Dave Peterson