Table missing data of first record entered into subform

G

Guest

I have a form with three combo boxes on the main form and a subform to enter
data. Record source for both the main form and subform is qryTransactions.
I use the boxes to select Location, Month, and Category. The subform allows
the user to enter multiple records contiain description and amount. The form
works fine except for the first record in the table only contains Location,
Month and Category--the Amount and description shows up as the second record
in the table. If I close the form and enter some more data the same thing
happens. I end up with a first entry with only the data selected from the
combo boxes.
 
T

tina

if you're trying to enter multiple records in the subform, that all have the
same Location, Month, and Category - then it sounds like you should have two
tables, as

tblTransactions
TransID (primary key, probably an Autonumber data type)
Location
TransMonth (don't use "Month" as a field name; it's a Reserved word in
Access)
Category

tblTransActionDetails
DetailID (primary key, probably an Autonumber data type)
TransID (foreign key from tblTransactions)
Amount
Description

the relationship is:
tblTransactions.TransID 1:n tblTransactionDetails.TransID

one transaction record may have many detail records, but each detail record
belongs to only one transaction record - the definition of a one-to-many
relationship.

from a forms standpoint, bind your main form to tblTransactions (or a query
based on tblTransactions), and bind the subform to tblTransactionDetails (or
a query, ditto). make sure the the subform's LinkChildFields and
LinkMasterFields properties both are set to TransID. enter the transaction
data in the main form, then move to the subform to enter detail records
about that transaction, and Access will automatically enter the TransID
primary key value in the subform's TransID field.

hth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top