Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / March 2005

Tip: Looking for answers? Try searching our database.

setting the selected row in a subform

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Martin Payne - 11 Mar 2005 00:09 GMT
Hi all,

New to forum, hoping you can help.

I have a datasheet view subform that I have configured so that, when
you double click on certain fields it will open up a second form that
allows you to modify the value for that record.  When you submit the
second form, it updates the database and refreshes the parent form
(with subform).

My problem is that, after the refresh, the subform reverts to the top
record.  So, if you were modifying the value of the 400th record, you
would have to scroll back down again to modify the 401st record, and so

on.

What I want to do is, in the code for the submit button of the second
form (where it already specifies the refresh of the parent form before
it closes), I want to set the active record in the subform of the first

form.

I already know what the record is because, in the double-click event
that opens up the second form, I set a hidden field with the value of
CurrentRecord of the subform.  But, when the form is in form view, the
CurrentRecord property is read-only, so I can't use that property on
the reverse side.

I also tried the DoCmd.GoToRecord method, but that tells me that the
(sub)form is not open.

Any ideas?

Thanks
Martin
AlCamp - 11 Mar 2005 01:52 GMT
Martin
  Check out Steve Leban's SetGetScrollBars.zip at
http://www.lebans.com/SelectRow.htm
  It has the code which will allow you to requery/refresh a subform, and
have it restored to it's original position.  It works well.

  Or... pass a unique value ffrom the subform record you're at to a
variable, and after the referesh/requery, do a Find Record for that value.
The subform may appear to jump, but at least you'll be back on the
originating record.
hth
Al Camp

> Hi all,
>
[quoted text clipped - 31 lines]
> Thanks
> Martin
Jonathan Parminter - 11 Mar 2005 01:57 GMT
> Hi all,
>
[quoted text clipped - 31 lines]
> Thanks
> Martin

Hi Martin, use the following (air code) as an example...

' assuming that the current record has a unique identifier
dim lngRecordID as long

' assign to variable the value of the unique identifier
lngRecordID=txtRecordID

' code to open other form and requery the subform

' find the previous active record using recordset clone
me.recordsetclone.findfirst "RecordID=" & lngRecordID
me.bookmark=me.recordsetclone.bookmark

Luck
Jonathan
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.