View Full Version : To AutoFill or Not To AutoFill


teh1
10-17-2001, 08:59 AM
This should be about as simple as it gets, yet I can't determine how to do it.

I have a table with form that I want to enter data. The fields in the table are: Invoice, InvoiceDate, & Amount. The Invoice and InvoiceDate will be the same for 50 or so entries. On a form, how can I just enter the Invoice and InvoiceDate one time and have it autopopulate itself for every Amount that is entered? Will some sort of Autofill do the trick or is there something easier?

I originally thought I could create a Main/Subform and have the Invoice and InvoiceDate on the Main Form with the Amount in the Subform but couldn't get it to work exactly like I wanted.

Pat Hartman
10-17-2001, 09:06 AM
There must be some other piece of information that would cause you to need to enter 50 items otherwise why not just sum the Amount field?

Once you figure out what the other piece of information is, you should see that you need two tables. One to hold the information that occurs once per invoice and the second to hold the invoice details. This is identical in concept to the Order/OrderDetails examples found in Northwind.mdb and Orders.mdb. Take a look at them to see how to build your forms.

teh1
10-17-2001, 11:15 AM
Pat,

You are correct, there is other info but I was trying to keep the example as simple as possible yet contain everything that I need done. I simply need to be able to enter data into ONE table using a form but having repeating values for two fields and allow me to enter data for a field that does not repeat. This is not a "true" invoice in the normal sense.

I'll take a look at the example that you mentioned to see if it has a method of doing just that.

Thanks

Pat Hartman
10-17-2001, 08:51 PM
Regardless of how you want to think about it, you DO have a one-to-many relationship and you DO need TWO tables. Once you define the tables properly, you will find that building the form is much easier and more logical.

teh1
10-18-2001, 05:16 AM
Thanks for the info. I have many tables in the database. Again, I was trying to keep the example simple since it didn't require details of other tables. I only needed to enter data in this table. The one-many relationship does not come into play with entering the data on this form.

Thanks to code from Jack Cowley that I found in another message, I got it to work exactly as I wanted.