2424: The text you entered has a field, control, or property name that ...

  • Thread starter Bill R via AccessMonster.com
  • Start date
B

Bill R via AccessMonster.com

....[mdb] can't find.

This is strange! I have the following code:

If Not IsNull(Me.txtMSDSID) Then
id = Me.txtMSDSID

The VBA evaluates the first line just fine. So why do I get the subject error
msg evaluating the 2nd line?
 
R

Rick B

What is "id"? Is that a field? Is it a variable? Did you "dim" it if it
is a variable?
 
B

Bill R via AccessMonster.com

Yes. id is an integer variable. Here's the complete sub:

Private Sub txtMSDS_DblClick(Cancel As Integer)
Dim id As Integer

If Not IsNull(Me.txtMSDSID) Then
id = Me.txtMSDSID
If id > 0 Then
DoCmd.OpenForm "frmMSDSForm", acNormal, , "MSDSID = " & id
With Forms!frmMSDSForm
.cmbFindMSDS.Visible = False
.Cycle = 1
End With
Else
DoCmd.OpenForm "frmMSDSForm", acNormal
End If
Else
DoCmd.OpenForm "frmMSDSForm", acNormal
End If

End Sub


Rick said:
What is "id"? Is that a field? Is it a variable? Did you "dim" it if it
is a variable?
...[mdb] can't find.
[quoted text clipped - 5 lines]
The VBA evaluates the first line just fine. So why do I get the subject error
msg evaluating the 2nd line?
 
B

Bill R via AccessMonster.com

FYI:

'Me' in this instance is referring to a popup form, and txtMSDSID is a txtbox
What is "id"? Is that a field? Is it a variable? Did you "dim" it if it
is a variable?
...[mdb] can't find.
[quoted text clipped - 5 lines]
The VBA evaluates the first line just fine. So why do I get the subject error
msg evaluating the 2nd line?
 
B

Bill R via AccessMonster.com

Boy, is my face red!!!!

I had inadvertently edited the control's source on the Data tab to "txtDMSID",
mistakenly thinking I was editing the control's name on the Other tab. I
changed it back to "DMSID" and now everything is AOK. Thanks for your help.

Bill

Rick said:
What is "id"? Is that a field? Is it a variable? Did you "dim" it if it
is a variable?
...[mdb] can't find.
[quoted text clipped - 5 lines]
The VBA evaluates the first line just fine. So why do I get the subject error
msg evaluating the 2nd line?
 
Top