On Wed, 23 Aug 2006 14:16:02 -0700, coastal wrote:
> Trying to get a command button to concatenate values in two text boxes and
> display it on to a label on the same form.
>
> I have
> Private Sub cmdDisplay_Click()
> lblFullName.Caption = txtFirst.Text & txtLast.Text
> End Sub
>
> I get an error saying the control needs to have the focus, but I have
> references to two controls (txtFirst and txtLast).
>
> Is there a fix?
In Access, it's a control's Value property you need to use, not it's
text property.
Look them up in VBA help to learn the difference.
Because the Value property is the control's default, you do not need
to state it:
lblFullName.Caption = txtFirst & txtLast
Note: Don't you want a space between the 2 names?
lblFullName.Caption = txtFirst & " " & txtLast
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
|