473,388 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Help with Subform and GoToLast command

Hi,

I have a form using tab controls. The 2nd tab control is named "weekly_details" in which I embedded a form called Frm:weeklydetails. What I want to happen is when I click on that tab control, the recordset shown is the last record in my table called "weeklydetails". My logic below doesn't seem to work very well. Any suggestions?

Expand|Select|Wrap|Line Numbers
  1. Private Sub Weekly_Details_Click()
  2.     'sets focus to the Subform Form_frm:weeklydetails
  3.     Me.Form_frm: weeklydetails.SetFocus
  4.     'move to the last record of the weekly details database
  5.     DoCmd.RunCommand (acCmdRecordsGoToLast)
  6. End Sub
Thanks.

Daryl
Oct 12 '11 #1

✓ answered by Stewart Ross

In my view a far simpler solution is to base your subform on a query, and within that query sort the data in reverse order on whatever key field or combination of fields determines the 'last record' you refer to. Access will always then show you the 'last record' when the form is opened.

-Stewart

2 1764
Stewart Ross
2,545 Expert Mod 2GB
In my view a far simpler solution is to base your subform on a query, and within that query sort the data in reverse order on whatever key field or combination of fields determines the 'last record' you refer to. Access will always then show you the 'last record' when the form is opened.

-Stewart
Oct 13 '11 #2
neelsfer
547 512MB
I use something like this to move to the last record in subform
Expand|Select|Wrap|Line Numbers
  1. DoCmd.GoToControl ("subformname")
  2. DoCmd.GoToRecord , "", acLast
Oct 14 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Illya Havsiyevych | last post by:
Hello All I have splitted my MDB into MDE and data MDB. In old whole MDB I have next piece of code to create an instance of a form with subform. ..... Dim objForm As New ...
4
by: Ig | last post by:
Hi, I have a main form, subform in it, and two command buttons on the main form - "Save and Close" and "Cancel and Close". What code should I put into "Cancel and Close" button in order to undo...
66
by: genestarwing | last post by:
QUESTION: Write a program that opens and read a text file and records how many times each word occurs in the file. Use a binary search tree modified to store both a word and the number of times it...
0
by: amar1223 | last post by:
hi all, I am stuck with a problem. it would be highly appreciated if anyone could help. i am executing a java program from my vb program using shell command. the java program outputs some text...
0
by: JimN1 | last post by:
Error: Update requires a valid UpdateCommand when passed DataRow collection with modified rows. This is a continuation of my previous table element update question. I am now getting the above...
12
by: adamurbas | last post by:
ya so im pretty much a newb to this whole python thing... its pretty cool but i just started today and im already having trouble. i started to use a tutorial that i found somewhere and i followed...
4
by: mforema | last post by:
Hey Everybody, I have a form with a label ("Enter Password"), a textbox (with a password InputMask), and two command buttons ("OK" and "Cancel"). I've successfully written code for the "OK" command...
9
by: edefikh | last post by:
I have a database called inventory, In it I have tables called network and environment. In the network table there is a row called ipaddr. I would like to be able to write a query that can find ip...
11
by: cooperkuo | last post by:
Dear all, I have a question about ADO in the subform. I know how to use ADO to insert/update/select data into the sigin form, but wehn I try to do it in the form with subform((Datasheet). I don't...
1
by: AlisonP | last post by:
Hi, I am a relatively new Access programmer, but have programmed computers in Fortran and done complex modeling for years. Am learning quickly, and have managed to figure everything out so far, but...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.