473,387 Members | 3,781 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Access2000 data Entry Unbound Form With Subform

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
4 2697
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: JH Higgins | last post by:
In Access (.mdb File) I have a subform on a form. Doing data entry on the subform works just fine. If I move the forms and tables over to a .adp I can no longer do data entry in the child...
3
by: Carmela | last post by:
Hello Readers, I am trying to update data on a form that is based on a query having a many-to-one-to-many relationship. I found this exciting link that seemed to have the solution for me: ...
5
by: lottaviano | last post by:
I am using Access 2002 and have two tables (Main and Actions) linked (in Relationships) on one field "CAL_ID" (primary key in Main Table). Main Table is a list of equipment. Actions Table lists...
4
by: MLH | last post by:
On a data entry only form. lets say a user opens your form and enters 4 consecutive records. Each time, he clicks your SAVE button and a record is save and the record set is advanced to a newrec. ...
2
by: badboybrown | last post by:
Good afternoon, Please can someone tell me the best way of calling up a form that will allow the user to only add new records. I have other forms that will be used to view the existing...
1
by: lesperancer | last post by:
I've got a form that is opened in readonly mode and no fields can be changed, great but if I click on a combo box that has an _enter() event that sets a field on my form to a value (albeit the...
1
by: BlackFireNova | last post by:
I'm using Access 2003, on Windows XP Pro. I have a subform which is launched from a command button on my main form. When this form opens, I have 2 fields which I have inserted VBA Code into to...
7
reginaldmerritt
by: reginaldmerritt | last post by:
I have a few forms which i have designed to be subforms to a mainform that has no fields or record source. The forms have an unbound textbox and combo box, which i use to seach the data on these...
6
by: Elizabeth Mitte | last post by:
I have a database with multiple tables, all interlinked via referentially enforced relationships between pks and fks. I am attempting to produce forms which will allow the user to enter data that...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.