Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Property Read Only

Status
Not open for further replies.

R8Y

IS-IT--Management
Aug 27, 2002
5
GB
Hi

This is doing my head in but is probably easy! I have two linked tables, "Main" and "Training". The Primary key in Main is Name and has a one to many link to Training. I then created queries on both tables.

Next, created a "main form" to record data in that table from the query, and inserted the "training" query as a sub form. The links work, but when I try to edit the first field in the sub form I get the meassage "This property is read-only and can't be set". When the message is clicked OK the field is perfectly useable.

What's going on?
 
The problem comes from using Name as a field name. In the form's code, you have a reference to the control Name (the default name for a control bound to the Name field) that is being misinterpreted as a reference to the form's Name property.

The best solution would be to rename the control something like "txtName", and then make the same change in your code where you refer to the control.

It's best to avoid using form property names as control names, but you can also get around it by replacing the incorrect reference(s) with Me!Name. The "!" operator will force Access to look for Name in its Controls collection, instead of looking for a property named Name. Rick Sprague
To write a program from scratch, first create the universe. - Paraphrased from Albert Einstein
 
Thanks Rick...a lesson well learned! Fortunately the dbase isn't huge, not many objects so it only took an hour to go through and get the modification in place.

Alan r8y
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top