MS Access Update Field on a SubForm

I have a subform and a field named User.  I need to update this field with a value from the Main form.  Any ideas?
LVL 2
CipherISAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mbizupCommented:
If you are using code from the mainform, this is the syntax:


Me.MySubformControlname.Form.txtMyTextbox = SomeValue
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mbizupCommented:
Using code from the subform to refer to a control on the mainform:

Me.txtMyTextbox = Me.Parent.txtParentTextbox

The exact placement of the code depends on when you want the update to occur
0
CipherISAuthor Commented:
This is what I need

Me.MySubformControlname.Form.txtMyTextbox = SomeValue

but its not working.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

mbizupCommented:
Make sure that you are using the control name for your subform. This might be different from it's actual form name.  This is the Name property of the 'frame' that houses your subform.

If needed I can take a look at a sample for you.
0
mbizupCommented:
Also, what are you using in place of SomeValue?
0
CipherISAuthor Commented:
I've tried the following

Me![sfrmLocation].Form.CreatedUser = "A"
Me![sfrmLocation].Controls("CreatedUser") = "A"

I'm getting "Can't assign a value to this object"
0
mbizupCommented:
What is the control source of "CreatedUser"?

Also, is your subform's recordsource an updateacble table or query?
0
mbizupCommented:
If possible, please post a sample including the relevant form and tables, with no sensitive data,
0
CipherISAuthor Commented:
The subform is

Me![sfrmLocation].Form.CreatedUser = "A"
Me![sfrmLocation].Controls("CreatedUser") = "A"

The tbl is tblLocation
0
mbizupCommented:
Are you able to upload an actual copy of the database (with no sensitive data), using the attach file feature?
0
CipherISAuthor Commented:
can't but i figured it out - i put code in the before update event of the subform and that worked.
0
CipherISAuthor Commented:
my solutino resolved the issue
0
mbizupCommented:
Excellent!  Code placement is a very important factor.  Glad you worked it out.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.