Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 10th, 2003, 08:05 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Melbourne, Vic, Australia.
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts
Default Subform Setfocus

I'm probably forgetting something really simple, but it escapes me as to what it is.:(

If got a subform, which gets a record inserted into it based on clicking an image on the main form. I want the focus to move to the last record of the subform after the image is clicked.

I've tried DoCmd.GoToRecord , "Subform", acLast
but that doesn't work,
nor does referring to the subform as Form_Subform or Forms!Form!Subform

Can someone tell me where I've been going wrong?

TIA

Steven


I am a loud man with a very large hat. This means I am in charge.
__________________
<hr noshade size=\"1\"><i><font color=\"blue\">I am a loud man with a very large hat. This means I am in charge</i></font id=\"blue\">
Reply With Quote
  #2 (permalink)  
Old June 10th, 2003, 08:12 PM
Registered User
 
Join Date: Jun 2003
Location: Lakewood, WA, USA.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You must set the focus to the subform first, then the docmd. Here's what your code would look like:

    ' Set focus to the subform
    NameOfYourSubForm.SetFocus
    ' Move to the last record on the subform
    DoCmd.RunCommand acCmdRecordsGoToLast


John Ruff - The Eternal Optimist :-)
Reply With Quote
  #3 (permalink)  
Old June 10th, 2003, 10:46 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Melbourne, Vic, Australia.
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Doesn't seem to work.
The focus basically stays on the subform the whole time, since there are no focusable controls on the main form - and it still just stays in the first record.

Would the fact that it's a continuous form somehow have something to do with it?

Steven

I am a loud man with a very large hat. This means I am in charge.
Reply With Quote
  #4 (permalink)  
Old June 10th, 2003, 11:14 PM
Registered User
 
Join Date: Jun 2003
Location: Lakewood, WA, USA.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try this:

On the Subform's Enter event add the following code:

DoCmd.RunCommand acCmdRecordsGoToLast


John Ruff - The Eternal Optimist :-)
Reply With Quote
  #5 (permalink)  
Old June 11th, 2003, 12:38 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Melbourne, Vic, Australia.
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm obviously not that clever - I overlooked a little command after the GoToLast that screwed it all up - DoCmd.Requery

Once again - I'm not that clever

Steven

There are 10 kinds of people in the world - those who understand binary - and those with friends
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setfocus on Pocket PC rtr1900 Classic ASP Basics 0 October 2nd, 2006 02:29 AM
Setfocus on textbox rtr1900 Classic ASP Basics 2 July 5th, 2006 05:40 AM
ListBox SetFocus Clive Astley Access 7 May 5th, 2004 11:07 AM
Setfocus from button on Commandbar simmy Access VBA 2 December 29th, 2003 11:45 AM
Setfocus from button on Commandbar simmy Access 2 December 29th, 2003 11:31 AM



All times are GMT -4. The time now is 03:54 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.