473,396 Members | 1,933 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Error msg when adding a new record to a subform

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
2 5756
<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

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Andante.in.Blue | last post by:
Hi everyone! In Access 97, I have a parent form and a subform that are both based on the same query. The main form is continuous and serves up a summary for each record. The subform provides...
8
by: Steve | last post by:
I have several pairs of synchronized subforms in an application. I have a Delete button for each pair that uses the following code or similar to delete a record in the second subform: ...
1
by: Dalan | last post by:
I can't seem to find a workaround of Query Syntax Error. Actually, the query performs just fine, except when the last record on a related subform is deleted, then it generates a Runtime Error 3075...
1
by: Dalan | last post by:
I'm experiencing a Query Syntax Error with an Access 97 Db. Actually, the query performs as expected when adding any new records or editing existing ones and even deleting records, EXCEPT when the...
9
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a...
7
by: Jan | last post by:
Hi: When I searched the newsgroup for this problem, I saw two or three instances of the question being asked, but it was never answered. Not too promising, but here goes: I have a form with...
10
by: Roger | last post by:
ms-access97 & sql server2005 two tables tblItem tblItemFeature form frmItem contains subform frmItemFeature each form is based on their respective table creating new record and filling in...
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.