A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Set focus in a specific record within a subform



 
 
Thread Tools Display Modes
  #1  
Old April 26th, 2010, 08:13 PM posted to microsoft.public.access.forms
KJL
external usenet poster
 
Posts: 8
Default Set focus in a specific record within a subform

I have a main form with a subform. The subform contains multiple records and
a hidden unique id which ties it to the main form. After I enter data into a
field on the subform, I am requering the main form. I would like the focus
to remain on the subform on the specific record the user is editing. I have
been able to get the focus to remain the subform however, the focus jumps to
the first record.

Any ideas?
This is my code:

Private Sub MP_Reserve_AfterUpdate()
Forms!Liability.Form.Requery
Forms!Liability!ClmntInfoForm!.SetFocus
Forms!Liability!ClmntInfoForm!.Form![BI Reserve].SetFocus

End Sub
  #2  
Old April 27th, 2010, 11:51 PM posted to microsoft.public.access.forms
Tore
external usenet poster
 
Posts: 12
Default Set focus in a specific record within a subform


I guess you could use the bookmark property of your subform:

http://msdn.microsoft.com/en-us/libr...ffice.10).aspx

Save the bookmark of the subform when you have selected the record and use
it whenever you need to go back to this subform record. I guess you could
declare a string variable to hold the bookmark in the header section of the
subform vba code.

Dim StrBookmark as string
strBookMark = me.bookmark
me.bookmark = strbookmark

Bookmarks are destroyed in situations as described in the article.

Regards
 




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:28 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.