?
Solved

unbound text box default value a concatenation of values from other subs

Posted on 2006-05-10
5
Medium Priority
?
284 Views
Last Modified: 2008-03-04
I'd like to make the default value of an unbound control a concatenation of the values of two txt boxes on other subforms. I've used =forms!frmMain.... & forms!frmMain... That's obviously not the right syntax. Any ideas?

E
0
Comment
Question by:eliwil
5 Comments
 
LVL 34

Expert Comment

by:flavo
ID: 16646376
This may help you:
Forms: Refer to Form and Subform properties and controls
http://www.mvps.org/access/forms/frm0031.htm
0
 
LVL 8

Expert Comment

by:infolurk
ID: 16646408
Do brackets help?
=(forms!frmMain.... & forms!frmMain... )
0
 
LVL 46

Expert Comment

by:tbsgadi
ID: 16646438
Hi eliwil,
Don't forget the "Form" something like
[Forms]![frmMain]![Subforms].[Form]![Text1]
Good Luck!

Gary
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 16646484
I prefer the use of Me.<nameofsubform>.form.<nameofcontrol>
ie.

two subforms, called Child1 and Child2,

MainFormTextBox.Value = Me.Child1.Form.txtBox.Value & Me.Child2.Form.txtBox.Value


0
 
LVL 58

Accepted Solution

by:
harfang earned 2000 total points
ID: 16647645
Hello eliwil

I think the problem is with "default value of an unbound control", not the actual syntax. This gets evaluated before the subforms even load, so that you cannot do much about it. Also, it doesn't really make sense. The default value for an unbound control is really only evaluated when the form opens, never again.

It's different for bound controls, because that's the value you get on the "new" record.

Perhaps you simply want to display the concatenation. In that case, use the Control Source property rather than the Default Value property. The user can still select the information for cut-and-paste, for example. If you need the user to later edit that information, you will have to write into your control through VB event handlers in your subforms...

Hope this helps!

(°v°)
0

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Question has a verified solution.

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

Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
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, …
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Suggested Courses

809 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