By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,793 Members | 1,269 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,793 IT Pros & Developers. It's quick & easy.

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

P: 99
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?

Nov 10 '09 #1
Share this Question
Share on Google+
4 Replies

Expert 100+
P: 903
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 ' while the subform just stores


Just my 2 cents.

Nov 11 '09 #2

Expert 2.5K+
P: 3,532
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)>
Nov 11 '09 #3

P: 99
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!
Nov 11 '09 #4

Expert 2.5K+
P: 3,532
Glad you got it working for you.

Linq ;0)>
Nov 11 '09 #5

Post your reply

Sign in to post your reply or Sign up for a free account.