By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,608 Members | 1,526 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,608 IT Pros & Developers. It's quick & easy.

Error 2465 - Can't find field 'forms' ???

P: n/a
MLH
"The following unexpected error occurred in Sub CopyMySQLbttn_Click,
line #250, CBF on frmVehicleChooserform. 2465: "Can't find the field
'forms' referred to in your expression. You may have misspelled the
field name, or the field may have been renamed or deleted."

The above error is returned when running the following click code.
I don't understand what the error means.

Private Sub CopyMySQLbttn_Click()
On Error GoTo ErrorCopyMySQLbttn_Click
Dim ThisForm As String
ThisForm = Me.Name

100 Dim dtxt As Object
125 Set dtxt = Me!TextHolder
150 Me!TextHolder = MySQL
175 DoCmd.GoToControl "TextHolder"
200 dtxt.SelStart = 0
225 dtxt.SelLength = 13
250 DoCmd.RunCommand acCmdCopy
275 MsgBox "Done"

ExitCopyMySQLbttn_Click:
Exit Sub

ErrorCopyMySQLbttn_Click:
Dim r As String, k As String, Message3 As String
r = "The following unexpected error occurred in Sub
CopyMySQLbttn_Click, line #" & Trim$(CStr(Erl)) & ", CBF on " &
ThisForm & "."
k = CRLF & CRLF & str$(Err) & ": " & Quote & Error$ & Quote
Message3 = r & k
MsgBox Message3, 48, "Unexpected Error - " & MyApp$ & ", rev. " &
MY_VERSION$
Resume ExitCopyMySQLbttn_Click

End Sub

Nov 15 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
MLH
BTW, the following works fine...

100 Dim dtxt As Object
125 Set dtxt = Me!TextHolder
'150 Me!TextHolder = MySQL
150 Me!TextHolder = "abcdefghijlkmnopqrstuvwxyz"
175 DoCmd.GoToControl "TextHolder"
200 dtxt.SelStart = 0
225 dtxt.SelLength = 13
250 DoCmd.RunCommand acCmdCopy
275 MsgBox "Done"

But MySQL is a global string - nothing more. The case in
which I'm using it, it is a 445-char string. Ideas on why it
fails?
Nov 15 '05 #2

P: n/a
MLH
And, this works too...

100 Dim dtxt As Object
125 Set dtxt = Me!TextHolder
150 Me!TextHolder = CStr(MySQL)
'150 Me!TextHolder = "abcdefghijlkmnopqrstuvwxyz"
175 DoCmd.GoToControl "TextHolder"
200 dtxt.SelStart = 0
225 dtxt.SelLength = 13
250 DoCmd.RunCommand acCmdCopy
275 MsgBox "Done"

It seems that A97 is trying to do something other than simply
pasting the string when line 150 reads...
Me!TextHolder = MySQL

I wonder what that might be? BTW, Me!TextHolder is an
unbound textbox control.
Nov 15 '05 #3

P: n/a
MLH <CR**@NorthState.net> wrote in
news:rc********************************@4ax.com:
And, this works too...

100 Dim dtxt As Object
125 Set dtxt = Me!TextHolder
150 Me!TextHolder = CStr(MySQL)
'150 Me!TextHolder = "abcdefghijlkmnopqrstuvwxyz"
175 DoCmd.GoToControl "TextHolder"
200 dtxt.SelStart = 0
225 dtxt.SelLength = 13
250 DoCmd.RunCommand acCmdCopy
275 MsgBox "Done"

It seems that A97 is trying to do something other than simply
pasting the string when line 150 reads...
Me!TextHolder = MySQL

I wonder what that might be? BTW, Me!TextHolder is an
unbound textbox control.


What's in the variable MySQL? Does it perhaps include a reference to
a control on a subform, such as this:

WHERE Field=Forms!MyForm!SubForm.Form!MyControl

If that's the source of the problem, this is precisely the kind of
thing I was trying to bring to your attention with DLookup() -- your
SQL string should resolve the value of that control before it is
stored, rather than depending on the SQL to be able to use the
Access expression service to resolve it.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 15 '05 #4

P: n/a
MLH
What's in the variable MySQL? Does it perhaps include a reference to
a control on a subform, such as this:

WHERE Field=Forms!MyForm!SubForm.Form!MyControl

If that's the source of the problem, this is precisely the kind of
thing I was trying to bring to your attention with DLookup() -- your
SQL string should resolve the value of that control before it is
stored, rather than depending on the SQL to be able to use the
Access expression service to resolve it.


I think that's probably what was going on. Using CStr(MySQL) was
enough to past the string into the control as a simple string w/o any
attempt to process it further.
Nov 15 '05 #5

P: n/a
MLH <CR**@NorthState.net> wrote in
news:ne********************************@4ax.com:
What's in the variable MySQL? Does it perhaps include a reference
to a control on a subform, such as this:

WHERE Field=Forms!MyForm!SubForm.Form!MyControl

If that's the source of the problem, this is precisely the kind of
thing I was trying to bring to your attention with DLookup() --
your SQL string should resolve the value of that control before it
is stored, rather than depending on the SQL to be able to use the
Access expression service to resolve it.


I think that's probably what was going on. Using CStr(MySQL) was
enough to past the string into the control as a simple string w/o
any attempt to process it further.


No, that wouldn't do the trick at all. CStr() does not evluate the
contents of what it is passed.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 15 '05 #6

P: n/a
MLH
I think that's probably what was going on. Using CStr(MySQL) was
enough to past the string into the control as a simple string w/o
any attempt to process it further.


No, that wouldn't do the trick at all. CStr() does not evluate the
contents of what it is passed.


I cannot understand why it works. I do know that if I take it out -
the error occurs and when I put it back in - the error disappears.
Nov 17 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.