Refresh Doesn't Allow Add if Ref Int Enabled

  • Thread starter Thread starter Davy
  • Start date Start date
D

Davy

I hope someone can help with this. I am building an items catalogue for a
local museum.

When a new item is received it is input to the Catalogue table via a form
which also shows a listbox of previous donors from the Donors table. If the
donor is a new one then a command button is pressed with opens the Donors
form in Add mode. Once the donors details are entered the Donors form is
closed and control returns to the Catalogue Form. This has a command button
which performs a Form Refresh and thus the new Donor can be seen in the list
box and selected. Everything works well.

However, when I enable Referential Integrity between the two tables, when
the Refresh button is clicked then the form doesn't refresh. Instead I get
the error message telling me that I cannot create this catalogue record
because a donor record must already exist.

Referential Integrity sounds like a good idea; anyway I can make it work in
this situation?

thanks

Davy
 
Referential Integrity sounds like a good idea; anyway I can make it work in
this situation?

I'd suggest using a Combo Box rather than a Listbox for the donors; a
Combo has a "Not In List" event which you can use to pop up the donor
form and enter a new donor. And it will requery the combo box when the
new record has been added. See Dev's sample code at:

http://www.mvps.org/access/forms/frm0015.htm
 
Back
Top