Link to home
Start Free TrialLog in
Avatar of KrisYoungNY
KrisYoungNY

asked on

How to default word into text field on a form?

Hello -

I have thee identical forms that all share one field (and others) - but I was hoping to make a form-specific field that would default a different word on each of the three different forms (One form would default the word, "Nonconformance Report", One form would default the word, "Material Substitution Request", One form would default the word, "Dwg/BOM Change Request".  

Inside one of the forms, I clicked on the field (that I want to default a word into) for properties and under the Data tab\Default Value, I typed, [   ="Nonconformance Report"  ] as an example - but it does not show up when I switch back to form view.  Is there a simple solution to this?  Can anyone help?
Avatar of GRayL
GRayL
Flag of Canada image

omit the equal sign.
In my test form, in a text box, with properties showing, under the Data tab in the Default Value I typed:

Nonconformist Report

with and without double quotes.  In the latter, the system entered them anyway.  When I tried to wrap the expression with brackets, I got an error message.  It does not like brackets in a Default Value.

ASKER CERTIFIED SOLUTION
Avatar of GRayL
GRayL
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Nick67
I don't quite understand what your requirement is.
<three identical forms that all share one field>
So, is the control that is going to display these form specific values bound to a control source?

If so, it will pick up the value from the underlying table when you are on a record.
When you are on a new record, it will be blank.

You could set it in the Dirty event

if nz(me.thecommoncontrol.value,"") = "" then
    me.thecommoncontrol.value = "Nonconformance Report"
end if

If it is an unbound control, and therefore just a glorified label, you could put the same code in the load event.
I am not clear on it's purpose.  Can you explain?

Avatar of KrisYoungNY
KrisYoungNY

ASKER

Thank you all for your help.  I see my foolishness.  It was working all along.  But it just wouldn't show on records that had already been entered.  It would only show on a new record.  

I wanted one table to house all the required fields for thee or four different kinds of major forms.  They all dealt with different aspects of Quality (Nonconformances, Customer Complaints, Specific-contract's Material Substitution requests, Permanent Drawing/Bill of Material Change requests, etc.) - but needed to be entered with minimal confusion - and be able to report general trends across all Quality aspects.  One of the reports will, for example, want to view all issues we've ever had with a certain kind of a widget (they could be nonconformances, customer issues, material changes, etc.) - and we'd want the list - but would also want to know what kind of an issue it was simply by looking ag the field that was defaulted on each of those forms (Nonconformance Report, Drawing change, Customer Complaint, etc).  Anyway, I appreciate Nick67's help but that didn't really address what I needed; I'll award the points to GRayL (thank you for seeing that I was clearly doing something that should have worked - and for checking my work thoroughly).
Thanks, glad to help.