GoTo Specific Record using VBA

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi,
I posted this question in the general section by accident.
oops.


I am currently trying to use VBA to code a command button
on a form in the following manner: While the current
record is visible, I would like to code the OnClick
funtion to go to the last record where a specific field
contains a specific entry, like

forms!Activity!Company=last entry for "Enron"

Thank you in advance!
 
John said:
Hi,
I posted this question in the general section by accident.
oops.


I am currently trying to use VBA to code a command button
on a form in the following manner: While the current
record is visible, I would like to code the OnClick
funtion to go to the last record where a specific field
contains a specific entry, like

forms!Activity!Company=last entry for "Enron"

Thank you in advance!

Where is this specific value you're looking for going to come from?
Would be in a control on the form?

What do you mean by "last record"? In what sense of last? Last
entered? Last in the form's current sort order? Last one before the
current record, or last one anywhere in the recordset?
 
Hi Dick,

I finally figured it out using the following:
Private Sub Enron_Click()
Forms![Activity]![company].SetFocus
DoCmd.FindRecord "Enron", , , acUp, , acCurrent, False
End Sub

Thanks for your help though!
cheers
 
Back
Top