GoTo Specific Record using VBA

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!
 
D

Dirk Goldgar

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?
 
J

John

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
 

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

Top