| re: Error msg when adding a new record to a subform
Brian Wilson wrote:[color=blue]
> <brenda.stow@hey.nhs.uk> wrote in message
> news:1127832978.661408.75380@g14g2000cwa.googlegro ups.com...[color=green]
> > error msg " An error occured while referencing the object. You tried to
> > run a visual basic procedure that improperly references a property or
> > method of an object"
> > This msg occurs everytime I add a new record to a subform. If I close
> > msgbox I can then successfully add new record.
> > Have looked on MS Technet and tried their 2 suggestions:-
> > 1)LinkChildFields property contains the name of a form property - this
> > isn't the case linkChildFields property is unit number;acq_date.
> > 2)If linking forms using 2 field then try adding a single control with
> > 2 fields as a concatonated sting.Tried this - different error msg"Can't
> > assign a value to this object - control on a read only form, I don't
> > think so because can go ahead and add a new record.
> > - object on a form in design view - No
> > - value too large for the field -No
> > Error doesn't occur if forms are not linked, but still occurs if
> > linking on just unit number so definately something to do with the way
> > I'm linking the two forms.
> > Help !![/color]
>
>
> For a start, I would add two textboxes on the subform which are the linked
> fields - name them differently from the fields in case you need to
> differentiate later e.g. txtField1, txtField2. Although, you won't need
> them in the final version, it may help you to see what's going on. You
> should also check whether the related table has default values (like a zero
> for a number) - this is hardly ever useful.
> I'm not sure if this is an issue here, but if you can avoid spaces in your
> field and table names, you will no longer have to ensure these are wrapped
> in square brackets - which can mess things up when you least expect.[/color]
Thanks for the reply. I already had 2 fields, removed a default value
of zero and tried removing spaces, thus square brackets.This didn't
help. I have however got round the problem by only setting the
LinkChildfields and LinkMasterFields when opening the form for editing,
so its got rid of the error msg when adding a new record. Thanks anyway. |