Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DoCmd.OpenTable on Last Record 2

Status
Not open for further replies.

sxschech

Technical User
Jul 11, 2002
1,034
US
Short of creating a datasheet form, can I directly open the table from a button using

Code:
DoCmd.OpenTable "tblComments"

And have it go to the last record. I tried

Code:
DoCmd.OpenTable "tblComments", acViewNormal, acAdd

but that doesn't show the previous records. Even though the goal is to add new records, the comments are often the same or similar, so would like them to be visible. Reason for opening table directly was trying to keep it simple if don't need to add another form. It's not a big deal to manually go to the last record as I have been, but would be nice if the computer could do that step for me.
 

I would NEVER do this unless you are the only one using it.
Users should ALWAYS use forms for data entry, preferably based on queries.
Code:
DoCmd.OpenTable "tblComments"
DoCmd.GoToRecord,acDataTable, "tblComments", acLast


Randy
 
How are ya sxschech . . .

Try:
Code:
[blue]   DoCmd.OpenTable "tblComments"
   DoCmd.RunCommand acCmdRecordsGoToNew[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Thank you both for your suggestions. It is good to know there is more than one way to accomplish a task.

Randy:
Either I or my coworker are the only ones that will be using this. This is so we can quickly update and enter data that we are entering comments which are explanations based on percentages and yearly comparisons that are displayed on a PDF file. Originally, I did have a form set up to do a lot of the prep work, but there were so many conditions/assumptions and the form took a while to load up, decided to scrap it for now. If eventually this is passed off to someone else, I'll revisit it.

In order to use your code, I had to remove acDataTable

Code:
DoCmd.GoToRecord , "tblComments", acLast

AceMan1:

Your code worked well and we will be using your version.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top