Subform problem (hopefully easy to solve?)

  • Thread starter Thread starter Mi Mi Crawley
  • Start date Start date
M

Mi Mi Crawley

I have a main form called "Journals" based on a table
containing the fields Name, Publisher, Country etc. The
field "Name" is the indexed primary key (no duplicates).

I have another form called "Issues" based on a table
containing the fields Name, January, February, etc (which
are yes/no boxes).

Both "Name" fields in both tables contain exactly the
same data and datatype.

I dragged and dropped the form "Issues" into the
form "Journals" and they are linked by the field "Name".
The tables are linked one to many by the field "Name" and
I have selected Enforce Referential integrity.

The form and subform seem to be linking ok, but when I
add a new record to the subform, then move to a new
record on the main form, if I then come back to the
original record on the main form, the new subform record
is not there. I checked the subform table and the new
record is there, but the "Name" field is blank.

I'm using Access 2002. Can anyone help please?
 
Select the subform and make sure that you have the
master/ child links set properly. It is under
properties, child & master links. It should read name;
name.

If you are doing an add record it should update this
directly. If you are searching it should find related
fields. If you are doing something strange try adding
the following code to the on load event of the subform
Me!name = forms![...whateverform name is...].name. This
will update the field in the subform.

Even though you have enforced integrity, I suspect you
have more keys or this isn't your key field. Otherwise
you could not have several records with blank names.

Goodluck
 
"Name" is an Access reserved word and you should avoid
using it and all other reserved words as a field name.
 
Many thanks Kevin, didn't know that, have now renamed
field to Jnl Name and have also carried out the other
suggestion posted in answer to my query and all seems to
be working fine now!

Yours gratefully, Mi Mi
 
Many thanks. Repeated the process, double checking master
and child links as you suggested (also renamed my field
from Name to Jnl Name) and everything seems to work ok
now. Originally did it on my PC at work (which has Access
2002), then did the repeat on my home PC (which has Access
2000). Don't know if that had anything to do with it, but
it's all working great now.

Gratefully yours, Mi Mi

-----Original Message-----
Select the subform and make sure that you have the
master/ child links set properly. It is under
properties, child & master links. It should read name;
name.

If you are doing an add record it should update this
directly. If you are searching it should find related
fields. If you are doing something strange try adding
the following code to the on load event of the subform
Me!name = forms![...whateverform name is...].name. This
will update the field in the subform.

Even though you have enforced integrity, I suspect you
have more keys or this isn't your key field. Otherwise
you could not have several records with blank names.

Goodluck

-----Original Message-----
I have a main form called "Journals" based on a table
containing the fields Name, Publisher, Country etc. The
field "Name" is the indexed primary key (no duplicates).

I have another form called "Issues" based on a table
containing the fields Name, January, February, etc (which
are yes/no boxes).

Both "Name" fields in both tables contain exactly the
same data and datatype.

I dragged and dropped the form "Issues" into the
form "Journals" and they are linked by the field "Name".
The tables are linked one to many by the field "Name" and
I have selected Enforce Referential integrity.

The form and subform seem to be linking ok, but when I
add a new record to the subform, then move to a new
record on the main form, if I then come back to the
original record on the main form, the new subform record
is not there. I checked the subform table and the new
record is there, but the "Name" field is blank.

I'm using Access 2002. Can anyone help please?
.
.
 
Back
Top