Open Form To Last Record

A

Anthony Viscomi

I seem to be having a "brain freeze"; I have the following VBA and would
like for the frm to open to the last record:
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Transactions Subform"
stLinkCriteria = "[SS]=" & "'" & Me![SS] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

The form is opened via a cmdButton on another form.

Thanks!
Anthony
 
G

Guest

hi,
what is the problem? form not opening to last record or
just not opening? what is SS?
what i saw first was Me![SS]. you have 2 forms open. which
form does me refer to?
Post more info
 
A

Anthony Viscomi

The form is not opening to last record
hi,
what is the problem? form not opening to last record or
just not opening? what is SS?
what i saw first was Me![SS]. you have 2 forms open. which
form does me refer to?
Post more info
-----Original Message-----
I seem to be having a "brain freeze"; I have the following VBA and would
like for the frm to open to the last record:
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Transactions Subform"
stLinkCriteria = "[SS]=" & "'" & Me![SS] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

The form is opened via a cmdButton on another form.

Thanks!
Anthony


.
 
G

Guest

hi again,
guess on my part but try changeing me.[SS] to
[Forms]![Form1]![SS]
i think the me![SS] is confusing access.
-----Original Message-----
The form is not opening to last record
hi,
what is the problem? form not opening to last record or
just not opening? what is SS?
what i saw first was Me![SS]. you have 2 forms open. which
form does me refer to?
Post more info
-----Original Message-----
I seem to be having a "brain freeze"; I have the following VBA and would
like for the frm to open to the last record:
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Transactions Subform"
stLinkCriteria = "[SS]=" & "'" & Me![SS] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

The form is opened via a cmdButton on another form.

Thanks!
Anthony


.


.
 
A

Anthony Viscomi

Actually, I may have solved the issue by assigning a descending sort the an
Index field
hi again,
guess on my part but try changeing me.[SS] to
[Forms]![Form1]![SS]
i think the me![SS] is confusing access.
-----Original Message-----
The form is not opening to last record
hi,
what is the problem? form not opening to last record or
just not opening? what is SS?
what i saw first was Me![SS]. you have 2 forms open. which
form does me refer to?
Post more info

-----Original Message-----
I seem to be having a "brain freeze"; I have the
following VBA and would
like for the frm to open to the last record:
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Transactions Subform"
stLinkCriteria = "[SS]=" & "'" & Me![SS] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

The form is opened via a cmdButton on another form.

Thanks!
Anthony


.


.
 
G

Guest

Could also add this in Form_Open of the form being opened.

DoCmd.GoToRecord acForm, Me.Name, acLast

Ensure RecordSource of form is sorted the way you want.
 
A

Allen Browne

Anthony, if you want the form to open with all records, but view the one you
were working on last, see:
Return to the same record next time form is opened
at:
http://members.iinet.net.au/~allenbrowne/ser-18.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Anthony Viscomi said:
Actually, I may have solved the issue by assigning a descending sort the
an Index field
hi again,
guess on my part but try changeing me.[SS] to
[Forms]![Form1]![SS]
i think the me![SS] is confusing access.
-----Original Message-----
The form is not opening to last record
hi,
what is the problem? form not opening to last record or
just not opening? what is SS?
what i saw first was Me![SS]. you have 2 forms open. which
form does me refer to?
Post more info

-----Original Message-----
I seem to be having a "brain freeze"; I have the
following VBA and would
like for the frm to open to the last record:
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Transactions Subform"
stLinkCriteria = "[SS]=" & "'" & Me![SS] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

The form is opened via a cmdButton on another form.

Thanks!
Anthony
 

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