For a macro's SetValue action, there are two arguments. Expression is the
actual value to be written into the control. Item is the name of the
control.
If you're running the macro from the form that contains the control, then
you don't need to use all the Forms!FormName stuff; you can just use the
control name by itself.
[NameOfControlOnFormThatCallsTheMacro]
Otherwise, the Item should be this syntax:
[Forms]![NameOfForm]![NameOfControl]
You do not put the text expression into the Item argument; that goes in
the Expression argument. For example, suppose I want to write the text
string "I Have A Plan" into the txtPlans control on the form
MyPlanningForm. Here are the appropriate arguments for the SetValue
action:
Item: [Forms]![MyPlanningForm]![txtPlans]
Expression: "I Have A Plan"
--
Ken Snell
<MS ACCESS MVP>
Legler said:
I appreciate the feedback, but there must be something between the the
designation of the item, and the string. I've tried the following:
[Forms]![formname]![field/control name] & "My Text String"
I've used = in place of the &
When I just put a space there, I get an error that says Access can't
parse
it. I'm at a loss. Pardon my frustration, but I will never understand
why
this app makes such a simple thing so complex.
Thanks,
Legler
:
General answer is an expression similar to this as the Expression
argument:
"Here Is My Text String"
--
Ken Snell
<MS ACCESS MVP>
I've read the help section on SetValue. I've read the books I have,
but
still can't get this to work. Clearly I don't have the expression
syntax
correct. How do I (what is the syntax) insert text into a field, on
a
form,
using the the SetValue action. I also want the current value of the
field
to
be overwritten, not just added to. Any help will be very much
appreciated.
Thank you in advance