last recordset

M

mino

I ask you kindly suggestion. On a form I have an unbound combobox to select the names of the text control "names." Some names are repeated often and I would like that, when I choose a name that has multiple instances, it appears the last record
of that name.I tried with rs.MoveLast (after initializing recordset.clone etc.) but always takes me to the last record in the database (and not the last record of the name clicked on the combo).

I thank for your eventual help.(sorry for my english ,I am from italy)
 
J

John W. Vinson

I ask you kindly suggestion. On a form I have an unbound combobox to select the names of the text control "names." Some names are repeated often and I would like that, when I choose a name that has multiple instances, it appears the last record
of that name.I tried with rs.MoveLast (after initializing recordset.clone etc.) but always takes me to the last record in the database (and not the last record of the name clicked on the combo).

I thank for your eventual help.(sorry for my english ,I am from italy)

If the recordset is based on a sorted query, it should move to the last record
in that sort order. If you have not specified an ORDER BY in the query, then
you are correct - it will use the table storage order.

What is the Rowsource of the query? Could you post your code? What order
(within the repeated records for a name) do you want it to choose?
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 
M

mino

Il giorno domenica 28 ottobre 2012 01:33:34 UTC+2, John W. Vinson ha scritto:
If the recordset is based on a sorted query, it should move to the last record

in that sort order. If you have not specified an ORDER BY in the query, then

you are correct - it will use the table storage order.



What is the Rowsource of the query? Could you post your code? What order

(within the repeated records for a name) do you want it to choose?

--
thanks for your answer , this is :
Private Sub CasellaCombinata6_AfterUpdate()

Me.Recordset.FindLast "CustomerID=" & Me.CasellaCombinata6

End Sub
In the box " select custmerid,company from tblcustemer;
That all.
 
J

John W. Vinson

thanks for your answer , this is :


Me.Recordset.FindLast "CustomerID=" & Me.CasellaCombinata6

End Sub
In the box " select custmerid,company from tblcustemer;
That all.

What box??

What is the Form's Recordsource? That Recorsource will define the sort order
of Me.Recordset.

Recordset.FindLast will NOT find the last company in alphabetical order
because (if i understand correctly) you have not told Acces to sort the
recordset. If the Form's Recordsource query were (using your spelling)

SELECT custmerid,company FROM tblcustemer ORDER BY Company;

then the records would be sorted alphabetically by Company. I'm not certain
that is what you want though!
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 
M

mino

Il giorno lunedì 29 ottobre 2012 00:14:53 UTC+1, John W. Vinson ha scritto:thanks , your help has solved my problem.You take me think to rowsource andI solved introducing Max in the sql code.
By
 

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