Is there a way to enter data into a subform before you enter into main form?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AdamOnAccess
    New Member
    • Aug 2008
    • 99

    Is there a way to enter data into a subform before you enter into main form?

    Here's a strange situation:

    I'm building an application that contains a One-To-Many relationship, and the application has a main form with a sub form to maintain the relationship for data entry.

    In the "one" table are home page URLs of websites like:
    www.BusinessSit e.com

    In the "many" table are URLs for other pages under the "One" domain like:
    www.BusinessSit e.com/folderName/PageInSite.html

    I noticed that if you enter the "many" URL into the form first, you can extract the home page, and you don't have to spend time entering the data twice.

    But to accomplish this, I'll have to enter data into the subform BEFORE I enter data into the mainform.

    Is there a way to do this?

    Thanks,
    Adam
  • mshmyob
    Recognized Expert Contributor
    • Jan 2008
    • 903

    #2
    Originally posted by AdamOnAccess
    Here's a strange situation:

    I'm building an application that contains a One-To-Many relationship, and the application has a main form with a sub form to maintain the relationship for data entry.

    In the "one" table are home page URLs of websites like:


    In the "many" table are URLs for other pages under the "One" domain like:


    I noticed that if you enter the "many" URL into the form first, you can extract the home page, and you don't have to spend time entering the data twice.

    But to accomplish this, I'll have to enter data into the subform BEFORE I enter data into the mainform.

    Is there a way to do this?

    Thanks,
    Adam
    I understand what you want but I am thinking why don't you just enter the protocol and host name in the one table (main form) and just the paths and parameters in the many table (subform) instead of typing the protocol and host name over and over.

    So the main form has 'www.BusinessSi te.com while the subform just stores

    folderName/Page1.html
    folderName/Page2.html
    etc.

    Just my 2 cents.

    cheers,

    Comment

    • missinglinq
      Recognized Expert Specialist
      • Nov 2006
      • 3533

      #3
      In Access, as in the Animal Kingdom, you cannot have a "child" before you have a "parent."

      The homepage URL needs to be in the main form's recordsource as the Primary Key, in the subform's recordsource as a Foreign Key, with the main form/subform being linked thru these two fields.

      You enter the home page URL in the main form and it will automatically be entered in the subform records without any user effort. You don't say what you're doing with the subform data, but whatever it is, you can simply concatenate the Foreign Key field and the rest of the URL for the individual pages of the site.

      Linq ;0)>

      Comment

      • AdamOnAccess
        New Member
        • Aug 2008
        • 99

        #4
        Originally posted by mshmyob
        I understand what you want but I am thinking why don't you just enter the protocol and host name in the one table (main form) and just the paths and parameters in the many table (subform) instead of typing the protocol and host name over and over.

        So the main form has 'www.BusinessSi te.com while the subform just stores

        folderName/Page1.html
        folderName/Page2.html
        etc.

        Just my 2 cents.

        cheers,
        Hi Mshmyob, Linq,

        The above idea did occur to me, but I saw that the relationship didn't always hold up. There are many cases where the main URL appears differently in sub URLs. The feature I'm considering would probably come into play about 70% of the time.

        I did come up with a good solution last night:

        In cases where I can extract the main URL from the sub URL, I copy the sub URL from the browser, paste it into the first field of the main form, and hit return. Now I have a parent record. The AfterUpdate Event of this first field triggers a procedure to take the contents of this field in the main form and places it in the proper field in the sub form, then procedure extracts the main URL and simply re-writes the data in the main form. The procedure finishes by setting focus on the first field in the sub form.

        This actually works out better because I've designed the AfterUpdate procedure to fire only in cases when it receives a Sub URL. I can still enter slightly different main urls into the main form, and the procedure will just ignore them.

        -Thanks for the help!
        -Adam

        Comment

        • missinglinq
          Recognized Expert Specialist
          • Nov 2006
          • 3533

          #5
          Glad you got it working for you.

          Linq ;0)>

          Comment

          Working...