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

Access2000 data Entry Unbound Form With Subform

P: n/a
Have main form with an unbound subform1 which is used for data entry.
Subform1 has a nested continuous unbound subform (subform2) which is used to
enter multiple records related to the record being entered in subform1.

Am using DAO method to save the records entered into subform1 & 2 into the
underlying tables (table1 & table2).

Record being entered in subform1 only gets its unique identifier when saved
to underlying table (primary key field is autonumber).

Any suggestions on best way to set up saving the related records in table2
(i.e. get the key field from the related record being saved in table1).
Prefer user to enter data in subform1 & 2 in one step and then press a save
button which will save the record to table1 and the related records to
table2.

Any suggestions greatly appreciated.

Bob
Dec 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hmm. Can you get the subsubform to generate more than one record? I
would think that you wouldn't be able to move to a second record there
if you're not saving the data somewhere (though I'm not sure of this).
If that's the case, you've got to look for some funky workaround.

One thought, which is probably how it would be done in a lot of other
programming languages, where there's no such thing as a bound form:
Make an array to store the data from the subsubform. Build a group of
controls that _looks like_ a continuous form, including navigation
buttons, which will have to shuffle data into and out of different rows
of controls, depending on what's in the array.

Then, when it's time to save all this, you save what's in the subform,
grab that ID value, and use that when you save the data from the array
into a table.

I did this for a form once, it's a bunch of work, but it's nothing too
complex. If you're going to do this, I would definitely suggest you
sketch out every ounce of code first--there are a bunch of operations
involved, and you'll want to abstract as much of it as possible, so you
can reuse as much code as possible.

I'll look for that code now, but I'm guessing it's long gone.

Jeremy

Dec 21 '05 #2

P: n/a
Had similar problem, couldn't save records on SF2, because ID was missing.
Work around was to save SF1 onENTER SF2.
Jan 2 '06 #3

P: n/a
Robert <ro*******@bigpond.com> wrote:
: Have main form with an unbound subform1 which is used for data entry.
: Subform1 has a nested continuous unbound subform (subform2) which is used
: to enter multiple records related to the record being entered in subform1.

<snip>
: Any suggestions on best way to set up saving the related records in table2
: (i.e. get the key field from the related record being saved in table1).
: Prefer user to enter data in subform1 & 2 in one step and then press a save
: button which will save the record to table1 and the related records to
: table2.

I just posted code to a thread called 'Year Numbers' that
needed to know the next autonumber that would be generated for
a table's primary key:
dim oMax as string
oMax = "ID DESC" 'Order by for Allen Browne's Elookup fn.

' This is the next autonumber that will be generated for field ID.
IDnext = Elookup("ID","PurchaseOrders", ,oMax) + 1

oMax forces the lookedup list to be sorted in descending order, so
when Elookup returns the first item in list, that number is the last
autonumber so far assigned; I add 1 to get the next number to be
assigned.
You can make this lookup each time you open subform1, and each time
you insert a subform1 record increment its value. Then you need to
make its value available to the subsubform as either a global
variable or one of these properties I haven't really learned to use yet.

You'll need to get the Elookup function from Allen Browne's website:
it's an extension that he wrote and makes freely available.
I found it using google.

: Any suggestions greatly appreciated.

: Bob
Jan 2 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.