Creating a Master/Sub Form for the Web
Hi Everybody,
I've got what I think is a tricky one! I've been doing a lot of reading about data shaping. (I would highly recommend this as a topic) There seems to be an area that is the logical progression of data shaping that nobody is addressing. I have a feeling it is because it's hard.
I have an Access Database that contains two tables (call them Header and Detail). The tables are linked and have a one-to-many relationship. I need to create an web interface for the creation of new records. This is easy for the Header table but I do not know how many associated records there will be in the Detail until run time. What I really want is a Master/Sub Form type interface.
As far as I can see there are two ways to handle this. I don't actually know how to do either so it is all a bit academic at the moment.
1) Create a form with the Header fields and the fields for one Detail record as well as a button to draw subsequent Detail lines. The detail records would have to be passed to the AddRecord.asp page in an Array with the header data being passed normally.
2) Create a form with the Header fields and a link to a page that would accept a single detail record. This detail page would accept detail records and update the detail table. The problem here is that the original page with the Header info has got to display this data so the user knows what has been entered so far.
Can anyone help me out here? Is this even possable? I'm nor afraid of having to do a bit of reading or branching out into Java or what ever else i need to do (everything is currently VBScript/ASP).
Thanks.
Peter J. Boettcher posted this at 13:13 — 23rd October 2001.
They have: 812 posts
Joined: Feb 2000
Well, there's about a million ways you could do this! In the web environment, it's not a good idea to update large amounts of data at once, it's better to send small chunks. If you were going to store everything on the client I wouldn't recommend going over 100 records.
If I were doing this for the web, I would take the approach you listed in number 1, except when they click the button to add more data I would have this form submit to itself and write the record to the database, then when the form refreshes, the record they just entered would be text (not form fields), with the new row of blank form fields below it.
PJ | Are we there yet?
pjboettcher.com
PaulCAust posted this at 02:24 — 24th October 2001.
They have: 25 posts
Joined: Aug 2001
Aroooow? Post the form to itself? This is a new consept. Anything I should know before I enbark on my experimentation?
Thanks
Paul Curtis
Peter J. Boettcher posted this at 13:25 — 24th October 2001.
They have: 812 posts
Joined: Feb 2000
Arooow indeed!
Instead of having a separate ASP page that handles the form submission, the form is submitted to itself, like:
<%
'Check to see if form submitted
If Request.Form.Count > 0 Then
'Form handling code goes here
End If
That's just a simple example to show you what I meant.
PJ | Are we there yet?
pjboettcher.com
PaulCAust posted this at 00:30 — 25th October 2001.
They have: 25 posts
Joined: Aug 2001
Thanks,
Thats cool! This will certainly help me along the way! You are CAPTAIN ANSWER MAN!
Regards,
A Fellow Canadian (now living in Melbourne Australia)
Paul
Mark Hensler posted this at 06:23 — 25th October 2001.
He has: 4,048 posts
Joined: Aug 2000
Captain P.B. ('n J, haha!) 8P
PaulCAust posted this at 06:26 — 25th October 2001.
They have: 25 posts
Joined: Aug 2001
umm ya what he said!!
whisper "what does that mean?"
Paul
Mark Hensler posted this at 06:42 — 25th October 2001.
He has: 4,048 posts
Joined: Aug 2000
P.B. 'n J. = Peanut Buttern 'n Jelly (as in the sandwich)
Peter J. Boettcher posted this at 13:00 — 25th October 2001.
They have: 812 posts
Joined: Feb 2000
Now all I need is a costume, I've already got the logo ( peanut-butter & jelly samich!)
PaulCAust posted this at 04:46 — 26th October 2001.
They have: 25 posts
Joined: Aug 2001
Gentlemen,
Thanks for your help. Peter thank you for your technical help and Mark thanks for your assistance in the marketing of CAPTAIN ANSWER MAN.
I have a working app now. I need to clean it up a bit but hay it works. If your interested in having a look let me know and I will send you the code (the actual app is on our intranet).
P.S. Peter your Cape is in the mail.
Paul
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.