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.

Update information on a subform from another subform

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
RAM - 18 Mar 2008 18:36 GMT
I have form called Schedule with two subforms. One subform shows appointments
by date and the second subform show appointments by time.  I want to update
the form showing appointments by time from the subform by date.  I tried the
method
Forms!APT![0800] = [AppTime].  Forms!APT is the subform showing
appointments by time and the [AppTime] is on the suform showing appointments
by date.  I get an error saying cant find the form APT referred to in your
Macro or VB Code.  

Thanks in advance for any help
Signature

AccessRAM

Klatuu - 18 Mar 2008 19:14 GMT
Subforms are not seen as form objects.  They are seen as the Source Obect
property of the subform control on your main form.  To reference a control on
a subform of the active form it would be:
Me.MySubFormControl.Form.ControlName

If on another Form it is slightly different
Forms!MyFormName!MySubFormControl.Form.ControlName

Note MySubFormControl is not the name of the form.  It is the name of the
subform control on your main form.
Signature

Dave Hargis, Microsoft Access MVP

> I have form called Schedule with two subforms. One subform shows appointments
> by date and the second subform show appointments by time.  I want to update
[quoted text clipped - 6 lines]
>
> Thanks in advance for any help
Douglas J. Steele - 18 Mar 2008 19:14 GMT
You can't refer directly to the form being used as a subform: you must refer
to it through its parent form. (In actual fact, subforms aren't part of the
Forms collection, which shows all open forms. Only the parent form is in the
collection).

You'll need something like:

Forms![NameOfParentForm]![NameOfSubformControlOnParentForm].Form![NameOfControlOnSubform]

Note that depending on how you added the form as a subform, the name of the
subform control on the parent form may be different than the name of the
form being used as a subform.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

>I have form called Schedule with two subforms. One subform shows
>appointments
[quoted text clipped - 10 lines]
>
> Thanks in advance for any help
RAM - 18 Mar 2008 20:03 GMT
I can update data from the subform to the main form.  But I'm trying to
update data from subform to subform.  I did not quite understand how to
implement your answer.  
Signature

AccessRAM

> You can't refer directly to the form being used as a subform: you must refer
> to it through its parent form. (In actual fact, subforms aren't part of the
[quoted text clipped - 23 lines]
> >
> > Thanks in advance for any help
Douglas J. Steele - 18 Mar 2008 20:14 GMT
Fields on subform 1 are referred to as

Forms![NameOfParentForm]![NameOfSubformControl1].Form![NameOfControlOnSubform1]

Fields on subform 2 are referred to as

Forms![NameOfParentForm]![NameOfSubformControl2].Form![NameOfControlOnSubform2]

Doesn't really matter whether your code is in the module associated with the
Parent form, with the form being used as Subform1 or with the form being
used as Subform2: that syntax will work everywhere.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

>I can update data from the subform to the main form.  But I'm trying to
> update data from subform to subform.  I did not quite understand how to
[quoted text clipped - 33 lines]
>> >
>> > Thanks in advance for any help
RAM - 18 Mar 2008 20:15 GMT
I got it figured out using the following code:
Forms![frmSchedule]![FrmAppTime]![800] = [Event]

Thanks for your help
Signature

AccessRAM

> I have form called Schedule with two subforms. One subform shows appointments
> by date and the second subform show appointments by time.  I want to update
[quoted text clipped - 6 lines]
>
> Thanks in advance for any help
Douglas J. Steele - 18 Mar 2008 20:41 GMT
You're missing the .Form in there. While it may be working on your present
version of Access, it's possible that it will stop working if a future
service pack causes Access to adhere closer to the correct syntax, and it
likely won't upsize properly to Access 2007.

Forms![frmSchedule]![FrmAppTime].Form![800] = [Event]

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

>I got it figured out using the following code:
> Forms![frmSchedule]![FrmAppTime]![800] = [Event]
[quoted text clipped - 16 lines]
>>
>> Thanks in advance for any help
Clif McIrvin - 19 Mar 2008 14:33 GMT
I completely missed that .Form when I found the syntax for getting to
subform
controls -- that's good to know, Thanks!

I have never been clear on the distinction between the "." and "!" in
the syntax,
and I never seem to be able to find my way back to references that I
have
stumbled across --- would someone please post an explanation, or point
me
towards an explanation?

tia

--
Clif

On Mar 18, 2:41 pm, "Douglas J. Steele"
<NOSPAM_djsteele@NOSPAM_canada.com> wrote:
> You're missing the .Form in there. While it may be working on your present
> version of Access, it's possible that it will stop working if a future
> service pack causes Access to adhere closer to the correct syntax, and it
> likely won't upsize properly to Access 2007.
>
> Forms![frmSchedule]![FrmAppTime].Form![800] = [Event]
Douglas J. Steele - 19 Mar 2008 15:41 GMT
The usual advice is that you use ! for things you created (such as forms or
controls on forms) and . for things Access created (such as properties).
However, you might read what Andy Baron's got at
http://my.advisor.com/doc/05352

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

I completely missed that .Form when I found the syntax for getting to
subform
controls -- that's good to know, Thanks!

I have never been clear on the distinction between the "." and "!" in
the syntax,
and I never seem to be able to find my way back to references that I
have
stumbled across --- would someone please post an explanation, or point
me
towards an explanation?

tia

--
Clif

On Mar 18, 2:41 pm, "Douglas J. Steele"
<NOSPAM_djsteele@NOSPAM_canada.com> wrote:
> You're missing the .Form in there. While it may be working on your present
> version of Access, it's possible that it will stop working if a future
> service pack causes Access to adhere closer to the correct syntax, and it
> likely won't upsize properly to Access 2007.
>
> Forms![frmSchedule]![FrmAppTime].Form![800] = [Event]
 
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.