By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,492 Members | 3,174 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,492 IT Pros & Developers. It's quick & easy.

Error msg when adding a new record to a subform

P: n/a
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 !!

Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
<br*********@hey.nhs.uk> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
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 !!

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.



Nov 13 '05 #2

P: n/a

Brian Wilson wrote:
<br*********@hey.nhs.uk> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
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 !!

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.


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.

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.