> Hi, Dirk. I'm not sure I followed all of what you were saying, but
> here's what I did (Access 2003, BTW):
[quoted text clipped - 17 lines]
>
> End Sub

Signature
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)
> > Hi, Dirk. I'm not sure I followed all of what you were saying,
> So you decided to take yet a different approach.
Well, I guess I _didn't_ understand what you were saying!!
> evaluates the value of the yes/no field? If you set the ControlSource
> property of txtKM to this expression:
>
> =IIf([Add_Sub_KM], "Add this value", "Subtract this value")
I tried that, but got a #Name error in the text box and another
message that the ControlSource referenced an invalid control.
> you can set its Value property any time,
> and that's what you would normally use.
I didn't know that - I'm used to working with forms in Word and Excel
VBA.
So I changed my existing code from
Me.txtKM.Text =
to
Me.txtKM.Value =
and took out the
DoCmd.GoToControl
and it works fine.
Thanks for the boost!!
Ed
On Jan 14, 7:57 pm, "Dirk Goldgar"
<d...@NOdataSPAMgnostics.com.invalid> wrote:
> > Hi, Dirk. I'm not sure I followed all of what you were saying, but
> > here's what I did (Access 2003, BTW):
[quoted text clipped - 49 lines]
>
> - Show quoted text -
Dirk Goldgar - 15 Jan 2008 20:40 GMT
>> =IIf([Add_Sub_KM], "Add this value", "Subtract this value")
>
> I tried that, but got a #Name error in the text box and another message
> that the ControlSource referenced an invalid control.
That suggests that one or both of two things is wrong:
1. The name of the text box may be the same as the name of one of the fields
in the form's recordsource. That's only allowed when the text box is bound
directly to the field in question. If that's the problem, just rename the
text box.
2. "Add_Sub_KM" may not be the correct name of the yes/no field or the check
box that is bound to it. If the name is wrong, that would explain both the
#Name error and ther message you got. If that's the case, you have to
correct the name used in the controlsource expression.
I can tell you that, in principle, this approach works. So if you want to
use it, you just have to figure out where the error is coming from and fix
it.
On the other hand, if you've got a different working solution, you can
ignore this.

Signature
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)