Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

MS Access Update Field on a SubForm

Posted on 2011-10-02
13
Medium Priority
?
460 Views
Last Modified: 2012-05-12
I have a subform and a field named User.  I need to update this field with a value from the Main form.  Any ideas?
0
Comment
Question by:CipherIS
  • 8
  • 5
13 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 2000 total points
ID: 36900901
If you are using code from the mainform, this is the syntax:


Me.MySubformControlname.Form.txtMyTextbox = SomeValue
0
 
LVL 61

Expert Comment

by:mbizup
ID: 36900904
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
 
LVL 1

Author Comment

by:CipherIS
ID: 36900941
This is what I need

Me.MySubformControlname.Form.txtMyTextbox = SomeValue

but its not working.
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 
LVL 61

Expert Comment

by:mbizup
ID: 36900957
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
 
LVL 61

Expert Comment

by:mbizup
ID: 36900964
Also, what are you using in place of SomeValue?
0
 
LVL 1

Author Comment

by:CipherIS
ID: 36900981
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
 
LVL 61

Expert Comment

by:mbizup
ID: 36900997
What is the control source of "CreatedUser"?

Also, is your subform's recordsource an updateacble table or query?
0
 
LVL 61

Expert Comment

by:mbizup
ID: 36900999
If possible, please post a sample including the relevant form and tables, with no sensitive data,
0
 
LVL 1

Author Comment

by:CipherIS
ID: 36901027
The subform is

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

The tbl is tblLocation
0
 
LVL 61

Expert Comment

by:mbizup
ID: 36901039
Are you able to upload an actual copy of the database (with no sensitive data), using the attach file feature?
0
 
LVL 1

Author Comment

by:CipherIS
ID: 36901297
can't but i figured it out - i put code in the before update event of the subform and that worked.
0
 
LVL 1

Author Closing Comment

by:CipherIS
ID: 36901299
my solutino resolved the issue
0
 
LVL 61

Expert Comment

by:mbizup
ID: 36901309
Excellent!  Code placement is a very important factor.  Glad you worked it out.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
Sometimes MS breaks things just for fun... In Access 2003, only the maximum allowable SQL string length could cause problems as you built a recordset. Now, when using string data in a WHERE clause, the 'identifier' maximum is 128 characters. So, …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question