If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Finding Last Record
Being very new to Access I am struggling a bit, so need some assistance.
I have an ACCESS 2000 manual and keep trying to figure it out, but I am just a bit ACCESS deprived. I have a form that will be used for New Employees. When I OPEN the form, (OPEN event, I think,) I need to get to the last record in my table. I have tried DoCmd.GoToRecord acDataTable, "SalesAssociate", acLast but get an error saying the table is not open. I have tried several other things, but nothing seems to work. I know I have it wrong, but can't figure it out. Any suggestions Thanks Wes |
#2
|
|||
|
|||
Finding Last Record
Wes
Access tables store data rather like "buckets o' data". That is, there's no inherent (human-perceptible) order. Thus, the "Last" record only makes sense if YOU have imposed some sort order. What you YOU mean by "last"? Regards Jeff Boyce Microsoft Access MVP -- Disclaimer: This author may have received products and services mentioned in this post. Mention and/or description of a product or service herein does not constitute endorsement thereof. Any code or pseudocode included in this post is offered "as is", with no guarantee as to suitability. You can thank the FTC of the USA for making this disclaimer possible/necessary. "Wes" wrote in message ... Being very new to Access I am struggling a bit, so need some assistance. I have an ACCESS 2000 manual and keep trying to figure it out, but I am just a bit ACCESS deprived. I have a form that will be used for New Employees. When I OPEN the form, (OPEN event, I think,) I need to get to the last record in my table. I have tried DoCmd.GoToRecord acDataTable, "SalesAssociate", acLast but get an error saying the table is not open. I have tried several other things, but nothing seems to work. I know I have it wrong, but can't figure it out. Any suggestions Thanks Wes |
#3
|
|||
|
|||
Finding Last Record
Hi -
If you are using this in a form, try using DoCmd.GoToRecord ,,acLast. This will go to the last record in whatever dataset the form is using as its RecordSource, e.g. tblEmployee If you are using the form to add new data, use acNew instead of acLast. John Wes wrote: Being very new to Access I am struggling a bit, so need some assistance. I have an ACCESS 2000 manual and keep trying to figure it out, but I am just a bit ACCESS deprived. I have a form that will be used for New Employees. When I OPEN the form, (OPEN event, I think,) I need to get to the last record in my table. I have tried DoCmd.GoToRecord acDataTable, "SalesAssociate", acLast but get an error saying the table is not open. I have tried several other things, but nothing seems to work. I know I have it wrong, but can't figure it out. Any suggestions Thanks Wes -- John Goddard Ottawa, ON Canada jrgoddard at cyberus dot ca Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...arted/201003/1 |
#4
|
|||
|
|||
Finding Last Record
On 3/18/2010 3:33 PM, Jeff Boyce wrote:
Wes Access tables store data rather like "buckets o' data". That is, there's no inherent (human-perceptible) order. Thus, the "Last" record only makes sense if YOU have imposed some sort order. What you YOU mean by "last"? Regards Jeff Boyce Microsoft Access MVP I need to ADD a new employee. In the Access manual, looking at the sequence of events, it indicates that using the OPEN event you can determine if this is a "new" reocrd. If so, you need to move to the end of the recordset. Otherwise you will continue to use the first record. Unfortunately, I am at a big disadvantage. I have several years of experience using the "big" relational databases, Oracle, Sybase, DB2, etc., and the programming is completely different. I am trying to learn to use ACCESS for a small business I am starting. At the moment it is challenging, but it looks like a really cool facility that has a lot of power. Oh, I do have some small amount of VBA experience, but that is from the EXCEL perspective. Thanks for the help Wes |
#5
|
|||
|
|||
Finding Last Record
Since Access tables are buckets o' data, you do not need to go to the last
record before adding a new one. Check Access HELP for "adding a new record". There's even a property in forms that lets them be used ONLY for entering new records. Again, Access keeps track of where it gets added, so you don't have to. Good luck! Regards Jeff Boyce Microsoft Access MVP -- Disclaimer: This author may have received products and services mentioned in this post. Mention and/or description of a product or service herein does not constitute endorsement thereof. Any code or pseudocode included in this post is offered "as is", with no guarantee as to suitability. You can thank the FTC of the USA for making this disclaimer possible/necessary. "Wes" wrote in message ... On 3/18/2010 3:33 PM, Jeff Boyce wrote: Wes Access tables store data rather like "buckets o' data". That is, there's no inherent (human-perceptible) order. Thus, the "Last" record only makes sense if YOU have imposed some sort order. What you YOU mean by "last"? Regards Jeff Boyce Microsoft Access MVP I need to ADD a new employee. In the Access manual, looking at the sequence of events, it indicates that using the OPEN event you can determine if this is a "new" reocrd. If so, you need to move to the end of the recordset. Otherwise you will continue to use the first record. Unfortunately, I am at a big disadvantage. I have several years of experience using the "big" relational databases, Oracle, Sybase, DB2, etc., and the programming is completely different. I am trying to learn to use ACCESS for a small business I am starting. At the moment it is challenging, but it looks like a really cool facility that has a lot of power. Oh, I do have some small amount of VBA experience, but that is from the EXCEL perspective. Thanks for the help Wes |
#6
|
|||
|
|||
Finding Last Record
If you want to move to the last record that the form is bound to.
DoCmd.GoToRecord acDataForm, "NameOfForm", acLast John Spencer Access MVP 2002-2005, 2007-2010 The Hilltop Institute University of Maryland Baltimore County Wes wrote: Being very new to Access I am struggling a bit, so need some assistance. I have an ACCESS 2000 manual and keep trying to figure it out, but I am just a bit ACCESS deprived. I have a form that will be used for New Employees. When I OPEN the form, (OPEN event, I think,) I need to get to the last record in my table. I have tried DoCmd.GoToRecord acDataTable, "SalesAssociate", acLast but get an error saying the table is not open. I have tried several other things, but nothing seems to work. I know I have it wrong, but can't figure it out. Any suggestions Thanks Wes |
Thread Tools | |
Display Modes | |
|
|