Subform editing with code (Advanced users) 
Author Message
 Subform editing with code (Advanced users)

We are having a very specific problem with some fields on a subform.  We
are setting default values in the fields on the subform whenever the
corresponding values on the main form change.

 For example, we have a customer address on the main form.  Whenever the
address fields change, we are attempting to copy the values from the
address fields on the main form into corresponding address fields on a
subform.

The problem we were running into was that our subform had data entry set
to "Yes", and every time the code filled in the address on the subform,
a new record was created.  Now, having realized what was going on, we
have set the "Data Entry" property to "No".

In theory, we should now be able to perform edits, (like setting the
value of the address on the subform) based on changes to the address on
the main form.  What we then ran into now, is an error stating that
"You can't assign a value to this object.".  The full text reads:

 Run-Time Error 2448
 You can't assign a value to this object
 -The object may be a control on a Read-Only form
 -The object may be on a form that is open in design view
 -The value may be too large for the field

We have checked and double checked these things that are suggested, and
the only thing we can find that makes any difference is whether "Data
Entry" is set to "Yes" or "No" on the subform.

We have tried the subform standalone, i.e. not run inside the main form,
and it works fine.

We have tried to change the data using a watch variable referencing an
object on the subform, and get the same error message.

We have checked every way we can think of to see if there is any
possibility of the fields, objects,  forms, etc being read-only, and
cannot find any way that they could be read-only.  Besides, we can
actually type new values directly into the address text objects on the
subform.

If anyone has had problems assigning values to text objects on a subform
when the reference is made using the proper syntax, please let us know
how you got around it.

Thanks much.



Sun, 28 Jan 2001 03:00:00 GMT  
 Subform editing with code (Advanced users)
Katherine,

When your code doesn't work, it is a good idea to post it, it will help
us help you.  For a complete reference to referring to main and subform
fields go to:
http://home.att.net/~dashish

But - you don't want to do what you are trying to do!  The beauty of
using a relational database is that you don't have to (nor should you)
store the same data twice.  So that addess only needs to be on the main
form, not the sub.

Keri Hardwick

Quote:

> We are having a very specific problem with some fields on a subform.  We
> are setting default values in the fields on the subform whenever the
> corresponding values on the main form change.

>  For example, we have a customer address on the main form.  Whenever the
> address fields change, we are attempting to copy the values from the
> address fields on the main form into corresponding address fields on a
> subform.

> The problem we were running into was that our subform had data entry set
> to "Yes", and every time the code filled in the address on the subform,
> a new record was created.  Now, having realized what was going on, we
> have set the "Data Entry" property to "No".

> In theory, we should now be able to perform edits, (like setting the
> value of the address on the subform) based on changes to the address on
> the main form.  What we then ran into now, is an error stating that
> "You can't assign a value to this object.".  The full text reads:

>  Run-Time Error 2448
>  You can't assign a value to this object
>  -The object may be a control on a Read-Only form
>  -The object may be on a form that is open in design view
>  -The value may be too large for the field

> We have checked and double checked these things that are suggested, and
> the only thing we can find that makes any difference is whether "Data
> Entry" is set to "Yes" or "No" on the subform.

> We have tried the subform standalone, i.e. not run inside the main form,
> and it works fine.

> We have tried to change the data using a watch variable referencing an
> object on the subform, and get the same error message.

> We have checked every way we can think of to see if there is any
> possibility of the fields, objects,  forms, etc being read-only, and
> cannot find any way that they could be read-only.  Besides, we can
> actually type new values directly into the address text objects on the
> subform.

> If anyone has had problems assigning values to text objects on a subform
> when the reference is made using the proper syntax, please let us know
> how you got around it.

> Thanks much.



Sun, 28 Jan 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. navigating for keyboard users - subfrom to form - subform to subform

2. Control name of subform from code behind subform

3. Prevent user to edit VBA code

4. Looking for a code example for editing security settings for users

5. Referencing object in form in code / Subform reference problem in code

6. ANNOUNCE: OCX & VBX - Advanced Edit Control

7. Set control to subform and allow edits

8. Using a main form to control the edit properties of a subform using VBA

9. Code for Edit|Copy, Edit|Paste

10. Edit code and delete code in database.Help!

11. user groups and advanced find

12. An advanced users help is required!!

 

 
Powered by phpBB® Forum Software