Results 1 to 11 of 11
  1. #1
    Join Date
    Aug 2003
    Location
    UK
    Posts
    78

    Unanswered: Form sub form relationship

    I have a couple of subforms on a main form. my subforms are based on different queries. How do i directly manipulate records in the subform in code?
    the light is on, someone is home, but they dont know they are. HELLO!

  2. #2
    Join Date
    Oct 2003
    Location
    São Paulo - Brazil
    Posts
    91

    Re: Form sub form relationship

    Originally posted by dapman2002
    I have a couple of subforms on a main form. my subforms are based on different queries. How do i directly manipulate records in the subform in code?

    Have u considered using Record Sets ?
    My environment: Windows XP/ Access 2000 - Using Microsoft DAO 3.6 Library

  3. #3
    Join Date
    Aug 2003
    Location
    UK
    Posts
    78

    Re: Form sub form relationship

    Originally posted by Mixirica
    Have u considered using Record Sets ?
    I am just exploring that now. Thanks Mixirica
    the light is on, someone is home, but they dont know they are. HELLO!

  4. #4
    Join Date
    Oct 2003
    Location
    Roanoke, Va
    Posts
    445

    Question Re: Form sub form relationship

    Originally posted by dapman2002
    I have a couple of subforms on a main form. my subforms are based on different queries. How do i directly manipulate records in the subform in code?
    Are you wanting to reference the controls on the subform or the underlying data with recordsets as Mixirica mentioned?

    Gregg

  5. #5
    Join Date
    Aug 2003
    Location
    UK
    Posts
    78

    Re: Form sub form relationship

    Originally posted by basicmek
    Are you wanting to reference the controls on the subform or the underlying data with recordsets as Mixirica mentioned?

    Gregg
    I am trying to add some records and edit others shown in the suform. Also select records in 2nd subfom based on selection in 1st subform.
    Last edited by dapman2002; 11-18-03 at 13:49.
    the light is on, someone is home, but they dont know they are. HELLO!

  6. #6
    Join Date
    Oct 2003
    Location
    Roanoke, Va
    Posts
    445

    Smile Re: Form sub form relationship

    Originally posted by dapman2002
    I am trying to add some records and edit others shown in the suform. Also select records in 2nd subfom based on selection in 1st subform.
    OK.

    To refer to a subform and its controls you can use code such as the following:

    Dim frm As Form, ctl As Control

    Set frm = Forms!MainFormName
    Set ctl = frm.SubformName (the subform is a main form control)

    With ctl.Form

    'use the Form property of the Subform to reference its controls and do something with them whether it be change a property or change a field value.


    End With

    Set frm = Nothing
    Set ctl = Nothing

    If you could provide a more specific example of what you are trying to do it might help. Also, are both of the subforms linked to the main form or is this a subform within a subform arrangement?

    Sometimes table manipulation is better accomplished with recordsets.

    Gregg

  7. #7
    Join Date
    Aug 2003
    Location
    UK
    Posts
    78

    Re: Form sub form relationship

    Originally posted by basicmek
    OK.

    To refer to a subform and its controls you can use code such as the following:

    Dim frm As Form, ctl As Control

    Set frm = Forms!MainFormName
    Set ctl = frm.SubformName (the subform is a main form control)

    With ctl.Form

    'use the Form property of the Subform to reference its controls and do something with them whether it be change a property or change a field value.


    End With



    Set frm = Nothing
    Set ctl = Nothing

    If you could provide a more specific example of what you are trying to do it might help. Also, are both of the subforms linked to the main form or is this a subform within a subform arrangement?

    Sometimes table manipulation is better accomplished with recordsets.

    Gregg
    Thanks basicmek
    what i have is a main form which is linked to a bookings and bookingdetail, table via a query, which gives all booking details for a flight or flights(each booking can contain more than one flight), in one subform i have a list of all passengers in the particular booking and in the second subform i have a list of all the flights in the booking. I want to be able to click on the second subform and display just the passengers for the selected flight and booking in the first subform.

    Thanks Dap
    the light is on, someone is home, but they dont know they are. HELLO!

  8. #8
    Join Date
    Oct 2003
    Location
    Roanoke, Va
    Posts
    445

    Smile Re: Form sub form relationship

    Originally posted by dapman2002
    Thanks basicmek
    what i have is a main form which is linked to a bookings and bookingdetail, table via a query, which gives all booking details for a flight or flights(each booking can contain more than one flight), in one subform i have a list of all passengers in the particular booking and in the second subform i have a list of all the flights in the booking. I want to be able to click on the second subform and display just the passengers for the selected flight and booking in the first subform.

    Thanks Dap
    Is this just for data display or data entry as well? I was just thinking that it sounded like something a listbox might be used for rather than a subform.

    Gregg

  9. #9
    Join Date
    Aug 2003
    Location
    UK
    Posts
    78

    Re: Form sub form relationship

    Originally posted by basicmek
    Is this just for data display or data entry as well? I was just thinking that it sounded like something a listbox might be used for rather than a subform.

    Gregg
    Thanks Gregg
    originally it was for data entry as well but as you say I could use list boxes and then invove a form fom there for data entry.

    Dap
    the light is on, someone is home, but they dont know they are. HELLO!

  10. #10
    Join Date
    Oct 2003
    Location
    Roanoke, Va
    Posts
    445

    Question Re: Form sub form relationship

    Originally posted by dapman2002
    Thanks Gregg
    originally it was for data entry as well but as you say I could use list boxes and then invove a form fom there for data entry.

    Dap
    Dap,

    Are you Ok with this or would you like a little help?

    And, did your original questions get answered or have the questions changed?

    Gregg

  11. #11
    Join Date
    Aug 2003
    Location
    UK
    Posts
    78

    Re: Form sub form relationship

    Originally posted by basicmek
    Dap,

    Are you Ok with this or would you like a little help?

    And, did your original questions get answered or have the questions changed?

    Gregg
    Thanks for your help and sorry for the late reply. I have used listboxes instead and envoke a form for the data input.

    Thanks DAp
    the light is on, someone is home, but they dont know they are. HELLO!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •