syntax to copy text string from another field to clipboard

  • Thread starter Thread starter tstew
  • Start date Start date
T

tstew

Hello,

The following code gets me close, but not quite. When this runs, I get an
error that the field doesn't exist. It's reading the text in the field as if
it's a field name. I'm just trying to copy the text string from Pic_Location
to the clipboard when I enter an unbound text box so it's ready to insert
into the next chosen record. The code is:
******************************************
Private Sub txtFilterAddress_Enter()

If Not IsNull(Me.Pic_Location) And Not (Me.Pic_Location) = "JL No Pic"
And Not (Me.Pic_Location) = "no pic" Then
DoCmd.GoToControl (Pic_Location)
DoCmd.RunCommand acCmdCopy
End If

End Sub
*******************************************
My reasoning for triggering the event on enter of the text box is that is
the last action performed on this record before selecting the next record.

Any ideas?

Thanks,
Mark
 
On Sat, 7 Nov 2009 15:46:04 -0800, tstew

DoCmd.GoToControl expects a control name; you gave it a control.
Rewrite it as:
DoCmd.GoToControl (:Pic_Location")
or
DoCmd.GoToControl (Me.Pic_Location.Name)

-Tom.
Microsoft Access MVP
 
Could it be that you are not referring to your field with the "ME...." in
front? It might not be able to find it without the designator in front.
 
Back
Top