Repost: Nop Duplicates on Subform

D

DEI

John,

Thanks for your help, and that is what I mean, however,
and it is the field on the subform that I am trying to
constrain. If I assign it a unique index, in design view
for the underlying table, it wont work because that field
has to duplicate itself for separate records, and thus in
the underlying table.

Does that make sense, am I making this too hard?

Maybe I am missing something.

I have a subform in Datasheet format with 5 fields making
up each record. I would like to prohibit the duplication
of one of those fields on the subform when it is attached
to the mainform, i.e. I will need to enable duplicates of
this field in the subform itself (same field attached to
different records of the main form).

I do have an autonumber primary key field for each record
in the subform, but the records in each subform are
updated over time and will not register as a duplicate
record right away, hence the need for preventing duplicate
fields.

Does this require code?

I'm not sure I understand what you mean. You want
to "prohibit the duplication of one of those fields on the
subform when it is attached to the mainform" but "enable
duplicates of this field in the subform itself". It sounds
like you want to simultaneously prohibit and enable
duplicates!

If - as I'm guessing - you mean that you want the field to
be unique within those records related to the mainform by
a Foreign Key field, simply create a unique Index on the
Foreign Key (the field used as the Child Link Field on the
subform) and the field you're trying to constrain.
 
W

Willy Wichtig

Hi DEI,

If you haven't yet solved your problem, perhaps you can post the relevant
table structures so that the NG has an idea of what you are doing.

Willy
 

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