473,543 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to reach the last record in a subform ?

Good evening to all

Here is my problem :

I have a form with a subform. They are linked.

When I open the form I would like the subform to reach its last
record.

I tried the method docmd.gotorecor d aclast but i did not
succeed.

Thank you for your help.

--
_______________ _______________ ___

Site photo personnel :

http://perso.wanadoo.fr/photodim
Nov 12 '05 #1
10 17468
On Sat, 30 Aug 2003 19:03:50 +0200, "Alain Guichaoua" <_@wanadoo.fr >
wrote:

mysubformcontro l.form.recordse tclone.movelast

-Tom.

Good evening to all

Here is my problem :

I have a form with a subform. They are linked.

When I open the form I would like the subform to reach its last
record.

I tried the method docmd.gotorecor d aclast but i did not
succeed.

Thank you for your help.


Nov 12 '05 #2
On Sat, 30 Aug 2003 10:20:34 -0700, Tom van Stiphout
<to*****@no.spa m.cox.net> wrote:

Sorry, that previous post ran away from me. Here is the full code:
dim rs as dao.recordset
set rs = mysubformcontro l.form.recordse tclone
rs.movelast
mysubformcontro l.form.bookmark = rs.bookmark
set rs=nothing

-Tom.

On Sat, 30 Aug 2003 19:03:50 +0200, "Alain Guichaoua" <_@wanadoo.fr >
wrote:

mysubformcontr ol.form.records etclone.movelas t

-Tom.

Good evening to all

Here is my problem :

I have a form with a subform. They are linked.

When I open the form I would like the subform to reach its last
record.

I tried the method docmd.gotorecor d aclast but i did not
succeed.

Thank you for your help.


Nov 12 '05 #3
On Sat, 30 Aug 2003 19:03:50 +0200 in comp.databases. ms-access, "Alain
Guichaoua" <_@wanadoo.fr > wrote:
Good evening to all

Here is my problem :

I have a form with a subform. They are linked.

When I open the form I would like the subform to reach its last
record.

I tried the method docmd.gotorecor d aclast but i did not
succeed.


Just stick to putting one record in the subform - voilla :-)

In the main form:
Private Sub Form_Current()
Dim rs As Recordset
Set rs = MySubForm.Form. RecordsetClone
If rs.RecordCount Then
rs.MoveLast
MySubForm.Form. Bookmark = rs.Bookmark
End If
rs.Close
Set rs = Nothing
End Sub
--
A)bort, R)etry, I)nfluence with large hammer.

(replace sithlord with trevor for email)
Nov 12 '05 #4
> I have a form with a subform. They are linked.

When I open the form I would like the subform to reach its last
record.

I tried the method docmd.gotorecor d aclast but i did not
succeed.


And yet another approach:

'************
Dim frm as Form
'Set reference to "subform"
Set frm = Me.MySubformCon trolName.Form

'Goto last record in subform
If frm.RecordsetCl one.RecordCount > 0 Then
frm.SelTop = frm.RecordsetCl one.RecordCount
End If
'************

--
Bruce M. Thompson, Microsoft Access MVP
bt******@mvps.o rg (See the Access FAQ at http://www.mvps.org/access)
NO Email Please. Keep all communications

within the newsgroups so that all might benefit.<<
Nov 12 '05 #5
Thank you Tom and Trevor, it works well.

Have a nice week-end

--
_______________ _______________ ___

Site photo personnel :

http://perso.wanadoo.fr/photodim
Nov 12 '05 #6
Thank you to you too, Lyle; It is really nice to get many
solutions. I want to reach the last record (the one before a new
one) as in your exemple.

Bye !
--
_______________ _______________ ___

Site photo personnel :

http://perso.wanadoo.fr/photodim
Nov 12 '05 #7
If the subform were showing ten records, would this show the last ten, with
the last one selected?


Yes.

--
Bruce M. Thompson, Microsoft Access MVP
bt******@mvps.o rg (See the Access FAQ at http://www.mvps.org/access)
NO Email Please. Keep all communications

within the newsgroups so that all might benefit.<<
Nov 12 '05 #8
"Bruce M. Thompson" <bthmpson@big_N OSPAM_foot.com> wrote in
news:vl******** ****@corp.super news.com:
Thank you to you too, Lyle; It is really nice to get many
solutions. I want to reach the last record (the one before a new
one) as in your exemple.


Uh ... as in my example, actually. <chuckle>


I'm very happy to confirm that it's Bruce's example.

<chuckle>

<chuckle>

--
Lyle

Nov 12 '05 #9
Comments interspersed.

"Lyle Fairfield" <ly******@yahoo .com> wrote in message
news:Xn******** *************** *******@130.133 .1.4...
"Bruce M. Thompson" <bthmpson@big_N OSPAM_foot.com> wrote in
news:vl******** ****@corp.super news.com:
If the subform were showing ten records, would this show the last ten,
with the last one selected?
Yes.
More specifically, when the recordcount *is* 10 - and the last record is the
Current record.

Hmmmm ... I'll try my question again.

If frm.recordcount is >10
Okay, there is a slight difference from that which I reported in what will be
visible in the subform control because I used exactly 10 records.
and

frm shows 10 only records
.... frm *exposes* only 10 records (just to make sure we are on the same
wavelength).
and record 1 is selected
In the current event, which is where my example code was supposed to be entered,
there is a current record, not a selected record, but that may not be what you
are trying to say.
what happens when this code is run:

frm.SelTop = frm.RecordsetCl one.RecordCount

?

Here in Canada only the last record is shown (and a "new" blank record if
appending is allowed).
Here in the US using Access 2000 on WinXP, when .Recordcount > 10, on Sunday,
the 31st of August, 2003, I see 9 records exposed (and a "new" blank record, if
appending is allowed). You may obtain different results. <g>
or am I missing something?
? <eg>
a kludge that could be used to display the last n records (where n =
number of records displayed in frm) and select the last is:

With Me
.SelTop = .RecordsetClone .RecordCount - _
(.InsideHeight - .FormHeader.Hei ght - .FormFooter.Hei ght) / _
.Detail.Height
.SelTop = .RecordsetClone .RecordCount
End With


Cool. Thanks, Lyle. :-)

--
Bruce M. Thompson, Microsoft Access MVP
bt******@mvps.o rg (See the Access FAQ at http://www.mvps.org/access) NO Email Please. Keep all communications

within the newsgroups so that all might benefit.<<
Nov 12 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
680
by: sixsoccer | last post by:
I have built a database with a <Mainform> and a <Subform>. My problem is twofold. 1. My subform is set as a continuos form with AllowAddiotions set to NO (ie. a list of Issues to the client on the mainform) 2. To add new issues, a button is used and a pop-up form is used to add an issue with more detail than what's available on the...
17
2512
by: michel.ank | last post by:
Hi, I'm using the class PrintLines and my last record of page aren't with the borders. Somebody can help me? Thanks,
0
1657
by: Andrew | last post by:
Hi all A quick question which I've not been able to solve from trawling the web. Is it possible to have a control in the detail section of a form set to a default view of "Continuous" which only appears on the last record? I'm thinking of having a form with a subform, and would like the
2
6295
by: arthur.dayton | last post by:
I am using Access 2007. I'm trying to set the control on a subform to the current time. My code is: Private Sub Command7_Click() With Me. ..Form.SetFocus ..Form!.SetFocus RunCommand acCmdRecordsGoToLast ..Form! = Now() End With
1
5023
by: gavm360 | last post by:
Hello, I have a subform that has a command button to move to the next record. If there are more records i would just like to move to the next record, When the last record is reached I would like an action to take place (havent decided what yet). I have not yet been able to get a Recordsetclone to work properly yet. can someone please...
7
6560
by: robtyketto | last post by:
Greetings, I have a main form. Upon filling in a combo box it then displays a subform (based on a query that uses values in the combo box on where clause) THe subform has the paramater Data Entry = 'No' as I want users to see all existing records and all additions/deletions and edits. However I want to move to the last record to default,...
3
5476
by: Kan09 | last post by:
i'm having a problem with the requery and move to last command on some subforms. The subforms are used to view the data enterd into the table. I have 3 forms that use subforms. On 2 of the subforms the requery is made and the data can be seen on the subform ,but the subform does not go to the las record enterd, the user having to search for...
1
2351
by: psyvanz | last post by:
here is the code im working with... hope you can understand? cause this thing searches the first one, not the last one record... i wanted ONLY to find the last record in a table... Please help me what was wrong with my code.. ================================================================================
1
1800
by: dekk | last post by:
Hi, Thanks for viewing this post. I have a subform called 'Time' that captures alot of time activity by day. Two of my fields are 'StartTime' and 'EndTime' I would like to increment the 'StartTime' for a new record (when focused on new record) by using the last record's 'EndTime'. Furthermore, I would like to set the 'EndTime'...
0
7410
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
1
7350
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7691
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5276
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4896
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3392
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1819
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
973
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
639
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.