Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Runtime Error 2465 2

Status
Not open for further replies.

BV874

Technical User
Nov 23, 2009
33
0
0
US
Hi,
I have a form that is running the following on close event when I get the runtime error 2465 for cannot find the field.

Here is the code I have:

Private Sub Form_Close()

If Me.STATUS = "COMPLETE" And Me.[CASE NO] Is Null Then
MsgBox "CASE NO IS REQUIRED IF THE ACCOUNT IS COMPLETE", vbCritical + vbOKOnly + vbDefaultButton2, "MISSING DATA"
Me.[CASE NO].SetFocus
Cancel = True
Exit Sub
End If

End Sub


I am new with sequel and any help would be appreciated.

Thanks.
 
the correct check is
isnull(me.[CASE NO])

that may be your issue.
 
Thanks for correcting that for me. I tried it and got the same error though. The sql now reads:

If Me.STATUS = "IN HCO" And IsNull([Me.CASE NO]) Then

Thanks.
 
My mistake,it reads the following.

If Me.STATUS = "IN HCO" And IsNull(Me.[CASE NO]) Then
 
My mistake, I wrote
[me.case no] which should have been me.[Case No]

Do yourself a favor and NEVER EVER make any names with spaces in them.

Double check you actually have a control (not a field) called "CASE No".
 
Anyway, the Close event procedure have no Cancel parameter, but the Unload ...

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
My control source was CASE_NO and my field name was CASE NO so I entered it incorrectly.

Thank you for your help!
 
Thank you PHV, you are absolutely right! I had to change it to the unload event.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top