Form/Table Problem

G

Gary D.

Okay, this is driving me nuts!

I have an Access97 database with two tables as follows:-

tbl_LOG_DATES
Primary Key: EntryID (AutoNumber)
Other column: EntryDate
(that's all, no other items)
tbl_LOG_ENTRIES
Foreign Key: ActivityEntryID (Number, Default value 0)
not primary but indexed with duplicates allowed
Other columns:
TimeStart can be Null
TimeEnd can be Null
Duration can be Null
…etc…

I have set up a relationship between the two with tbl_LOG_DATES
(EntryID) on the One side and tbl_LOG_ENTRIES (ActivityEntryID) on the
Many side, linked accordingly and the join type is 1 (only include
rows where the joined fields from both tables are equal). Referential
integrity is enforced with full cascades.

I have two forms:-
frm_LOG_DATES
frm_LOG_ENTRIES (as a subform, single form mode)

The subform is linked to the main form as:-
Link Master Fields: EntryID
Link Child Fields: ActivityEntryID
which is all pretty normal.


Problem:
When I open the main form and then immediately close it without
changing any data, there is no row added to the main table (which is
correct) but somehow a row gets added to the child table with its
ActivityEntryID set to Null, and sometimes I get a pop-up message
saying "You can't add or change a record because a related record is
required in table 'tbl_LOG_DATES'", which is pretty obvious and in
line with my intended integrity controls. So how come a row appears in
the child table?

What I don't understand, is that everything was working okay
previously but no this problem has arisen. I can't recall what changes
I have made recently, but they were only to the forms and not to the
underlying tables or the relationship.

Sorry for cross-posting but I wanted to gain a wide audience as I
desperately need help.

Can anyone see what's going wrong?
 

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