473,378 Members | 1,162 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,378 software developers and data experts.

"DoCmd.GoToRecord , , acLast" HELP

135 100+
My database has a form used to view maintenance for selected equipment. I select the equipment item from a combo box; the subform is then updated with all the relevant maintenance for that equipment item (master/child field linked on equipmentID). The maintenance subform is in datasheet view. Here is the problem: I can't figure out how to have the maintenance subform goto the last record after the equipment item is selected in the combo box on the main form. I thought to use the afterupdate event of the combo box on the main form. I just can't figure out how to tell the subform to goto or setfocus on the last record of the subform. ???????? Advice?
Dec 27 '08 #1
10 8531
RuralGuy
375 Expert 256MB
Here's how I would do it. In the AfterUpdate event of the ComboBox on the MainForm I would put:
' First set focus to SubFormControl
Me.SubFormControl.SetFocus
' Now set focus to a control on the SubForm
Me.SubFormControl.FORM.ControlName.SetFocus
' Now move to the last record of the SubForm
DoCmd.RunCommand acCmdRecordsGoToLast
Dec 27 '08 #2
MyWaterloo
135 100+
Thank you, I'll a try give it. What do you mean by a "control"? on the subform?
Dec 27 '08 #3
nico5038
3,080 Expert 2GB
Why not sort the subform descending ?
Thus the most recent is always on top.

Nic;o)
Dec 27 '08 #4
MyWaterloo
135 100+
@nico5038
Yes, I could do that... but I want the most recent to be at the bottom and then scroll back through to view older entries. The datasheet shows ten entries before having to scroll. I dunno, it just seems more logical to scroll back through the older records. Also, in descending i would still have to scroll to the bottom of the datasheet to make a new entry. Would like to be able to see the most recent entries and also be able to make a new entry. Anyway, I tried ""' First set focus to SubFormControl
Me.SubFormControl.SetFocus
' Now set focus to a control on the SubForm
Me.SubFormControl.FORM.ControlName.SetFocus
' Now move to the last record of the SubForm
DoCmd.RunCommand acCmdRecordsGoToLast "" I received an error that said there was no "SubFormControl". So i'm back to square one. Anyone??
Dec 27 '08 #5
RuralGuy
375 Expert 256MB
You have to use the name of your SubFormControl. Forms are displayed on other forms by means of a SubFormControl and it is the name of this control that is required first. Often it is named the same as the Form it is displaying. Fields are displayed on forms by means of controls. Often this is a TextBox control. Again, you *must* use your names for these elements and not my generic discription names.
Dec 27 '08 #6
nico5038
3,080 Expert 2GB
For most users scrolling down for older entries is rather "natural".

Personally I would add another (With property "Dataentry" set to "Yes") subform to let the user add a new row. Thus (s)he never has to reposition in the datasheet subform.

Nic;o)
Dec 27 '08 #7
MyWaterloo
135 100+
@nico5038
I disagree. =) When I write on a notepad I generally write from top to bottom. ; )
Same as in a Word or other type of document. Top to bottom. The most recent line being above the line being written. So it seems most natural to scroll back up to view what has already been read/written. I will, however, ponder the idea of a second subform for adding a new row.
Thanks for the help.
Dec 28 '08 #8
MyWaterloo
135 100+
@RuralGuy
That worked marvelously, thank you.
Dec 28 '08 #9
nico5038
3,080 Expert 2GB
@MyWaterloo
You're correct within the scope of the layout of a document, but by stacking documents on a pile the most recent will be on top and you'll need to dig "down" for the older ones <LOL>

Success with your application, I'm sure it will be a good one as you're thinking things through thoroughly !

Nic;o)
Dec 28 '08 #10
RuralGuy
375 Expert 256MB
@MyWaterloo
You're very welcome. Glad I could help.
Dec 28 '08 #11

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

Similar topics

6
by: Clément Collin | last post by:
I working on a GIS project, with Access link which just need a little routine in VBA, but I haven't knowledges in VBA language. It's very simple, and it looks like that in a TPascal way : .......
15
by: sara | last post by:
Hi I'm pretty new to Access here (using Access 2000), and appreciate the help and instruction. I gave myself 2.5 hours to research online and help and try to get this one, and I am not getting...
2
by: Andy Davis | last post by:
Dear Group I am trying to automate process of adding a new record id in my form using the following code when the user clicks the "Add New Record" button. For example if the last record id is...
7
by: Mathew Butler | last post by:
I'm investigating an issue I have when pulling data back from MS access I'm retrieving all rows from a column in a table of 5000 rows - accessing a column of type "memo" ( can be 65353 character...
1
by: AA Arens | last post by:
I my form I have put record navigation buttons. When I choose just before the last record, the "Go to next record" button, access automatically start with a new record instead of a message that...
11
by: dana1 | last post by:
I have a form which contains some buttons. The buttons use some of the standard images that come with access 2003 (e.g., the move next record image, or the sort ascending/descending images). The...
5
by: djsdaddy | last post by:
Good Day All, I have some EEO data in an old dBase4 database that I have converted to an Access table. Since dBase was not a relational database, I didn't create any key fields. I linked all of the...
2
by: Coolboy55 | last post by:
Hi, I'm using the Form_Dirty event to run DoCmd.RunCommand acCmdSaveRecord, but it does not appear to be working, although the event does trigger. I want the record on the main form to be saved...
16
by: g diddy | last post by:
Hi, I have used the Docmd.outputto function in various places in my code but for some reason all code that comes afterwards, even msgbox doesn't show. I was just wondering if there is anything that...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.