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 / March 2008

Tip: Looking for answers? Try searching our database.

Executing record operations from a Master Form to a Subform

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mark Asbell - 10 Mar 2008 03:51 GMT
Hi All

I have a single master form that is set up kind of like a web
page in that it has frame areas. Heading, Company
Logo, Main Work area - which is a subform, and there is a tree menu.
Selecting nodes in the tree menu changes the subform and hence the
operation being performed on the database.

I also have a frame on the master form that has a standard set of
buttons (I.e. Save, Delete, Move, Find, etc). My problem is that I
want these standard buttons to operate on the data in the subforms

Thus far I have tried:
1. Command from master form (format: DoCmd.GoToRecord ,
frmTreeMenu_SubForm.Name, acNext), but I get a 2489 error subform not
open
2. Calling a public routine (format: Call
frmTreeMenu_SubForm.Form.MoveNext) in subform. For the MoveNext
action, the routine executes, but I get a 2105 error - cant move to
specified record

Any help or ideas greatly appreciated
Mark
Albert D. Kallal - 10 Mar 2008 05:54 GMT
You have two choices:

1), make sure you move the focus to the subform *control*..and then execute
the move command

eg:

  Me.child1form.SetFocus
  DoCmd.GoToRecord acActiveDataObject, , acNext

The above does work quite well, but my spider sense does NOT like having to
use a focus switch.

2)

You can also put some code in the subform that moves to the next record such
as:

Public Function MoveNext()

  On Error Resume Next
  Me.Recordset.MoveNext

End Function

The above code would be placed in the SUB-FORM.

Then, in the main (parent form), you can reference the code/function like:

me.child1Form.Form.MoveNext

Note how you don't have to make a focus change. So, any public function
actually becomes a method of the form. And, of course, you can also declare
the function as a sub, and call it

Call me.Child1Form.Form.NameOfSub

So, you can build some custom public functions/subs...and call them..

if you don't want to write additional code in the sub-form code module, then
the first example of using the setfocus should work...

Signature

Albert D. Kallal    (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com

Mark Asbell - 10 Mar 2008 07:14 GMT
Thanks Albert

Was working on the subroutine modules but mine were using the Docmd object
which was not popular. Now just need to figure out how to work function for
'Find' and 'Filter'

Cheers
 
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.