Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I move a selected record to the top of the Datasheet after returning from another form?

Status
Not open for further replies.

smsmail

Programmer
Aug 11, 2010
105
US
Hello,

I have a subform, that displays in datasheet view. The datasheet displays a list of records from a SQL view.

On the datasheet I have a Job Number field (along with other fields). When the Job Number is double-clicked, another form is then opened that contains detailed information about that Job. When that form is closed, I would like to move the selected Job Number to the top of the datasheet, followed by jobs that are listed after.

The Datasheet form Record Source property is a sql statement:

SELECT * FROM dbo_view_invoicejobslist ORDER BY dbo_view_invoicejobslist.jobnumber DESC , dbo_view_invoicejobslist.drop;


The user do not want to re-scroll thru the Datasheet.

How would I do that? Thanks so much for your help!

smsemail
 
You if you return the job number from the popup then you can do something like

me.recordset.findfirst "jobNumber = " & lngJobNumber

But this only kind of works. If the row is not in the visible page then it will scroll it to the top of the form as desired. If it is in the visible page then it will only select that record and not move it to the top of the form. To control scrolling I think you are limited to using the Windows API.
 
Hi MajP

Thank you so much for your help.

I am a bit confused. I am not working with a record set. The forms Record Source property is:

SELECT * FROM dbo_view_invoicejobslist ORDER BY dbo_view_invoicejobslist.jobnumber DESC , dbo_view_invoicejobslist.drop;

When the called subform is closed, in the ON CLOSE event, I do a requery:

Forms![accountinghome].Form.sbfAccountingJobsList.Form.Requery

Can I still do a FINDFIRST?

Thanks so much for your help.

smsemail
 
Yzs:
Forms!accountinghome!sbfAccountingJobsList.Form.Recordset.FindFirst ...

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top