Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

MS Access subform code

Options
  • 09-04-2008 1:48pm
    #1
    Registered Users Posts: 952 ✭✭✭


    Ok so I have a simple form, with two subforms. Main form is artists, subform1 is albums and subform 2 is tracks.

    Anyway I'v managed to make a button on the main form for adding records to subform1 with the following code:
    Me!subform1.SetFocus
    DoCmd.GoToRecord , , acNewRec
    

    I'v tried to do the same thing with a different button to add records to subform2 but I'm having no luck. Why is this?
    Me!subform2.SetFocus
    DoCmd.GoToRecord , , acNewRec
    

    I'm guessing it's something to do with subform2 (tracks) being based on subform1 (albums)??


    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    I am also trying to get the subforms to resize automatically according to the number of records. For example some artists have more albums than others, the subform contains the list of albums but doesn't change in size regardless of whether there are 1 are 100 albums

    Thanks in advance


Comments

  • Closed Accounts Posts: 35 PeoplesMod


    Have you written out the structure of your tables on paper first? When designing any database it is better to get it down on paper first. Do you have any tutorials on MS Access and have you studied them? Let me know and I might be able to assist you here by providing you with a few good tutorials for you to study. However you will have to work it out yourself once you are given the required information as this is the best way to learn anything.


  • Registered Users Posts: 15,443 ✭✭✭✭bonkey


    Do you have one form with two sub-forms, or a form, with a sub-form, and a sub-sub-form?

    i.e. is it:
    Artist
      !--Albums
      !--Tracks
    

    or is it...
    Artist
      !--Albums
            !-- Tracks
    

    If the latter, you may find you need to go from form, to subform1, to subform2.


  • Registered Users Posts: 952 ✭✭✭Prezatch


    Thanks for the replies
    bonkey wrote: »
    Do you have one form with two sub-forms, or a form, with a sub-form, and a sub-sub-form?

    I'm not sure. How would I find out? Here are the relevant tables and relationships set up, and below that is a screenshot of part of the form:

    1.jpg
    2.jpg


  • Registered Users Posts: 952 ✭✭✭Prezatch


    Ok so I sorted out the first problem, I was doing everything right, just had a form incorrectly named. But I haven't a found a solution for the other problem:

    I am trying to get the subforms to resize automatically according to the number of records. For example some artists have more albums than others, the subform contains the list of albums but doesn't change in size regardless of whether there are 1 are 100 albums


Advertisement