473,385 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Expression Entered Refers to Object that is Closed or Doesn't Exist

This piece of code was working untill today, I now get runtime error code 2457 ("The expression you entered refers to an object that is closed or doesn't exist")

Here is the code I am using with the offending line underlined in bold. If this line fails I don't see why the first if statement doesn't also fail?

If anyone can help I would very much appreciate it.

Thanks

Client_Ref is the primary key
ViewReferral and ViewGen are yes/no boxes.


Expand|Select|Wrap|Line Numbers
  1. Private Sub Client_Ref_DblClick(Cancel As Integer)
  2. Me.Refresh
  3. If Me.ViewReferral = False And Me.ViewGen = True Then
  4. DoCmd.OpenForm "Gen_Users"
  5. DoCmd.ApplyFilter , "Client_Ref =" & Me.Client_Ref
  6. DoCmd.Close acForm, "ClientEntry"
  7. End If
  8. If Me.ViewGen = False And Me.ViewReferral = True Then
  9. DoCmd.OpenForm "Client"
  10. DoCmd.ApplyFilter , "Client_Ref =" & Me.Client_Ref
  11. DoCmd.Close acForm, "ClientEntry"
  12. End If
  13. If Me.ViewGen = True And Me.ViewReferral = True Then
  14. IRespond = MsgBox("Do you wish to view this customers referral information? (Selecting no will allow you to view their general user information", vbYesNo, "What would you like to see?")
  15. If IRespond = vbYes Then
  16. DoCmd.OpenForm "Client"
  17. DoCmd.ApplyFilter , "Client_Ref =" & Me.Client_Ref
  18. DoCmd.Close acForm, "ClientEntry"
  19. ElseIf IRespond = vbNo Then
  20. DoCmd.OpenForm "Gen_Users"
  21. DoCmd.ApplyFilter , "Client_Ref =" & Me.Client_Ref
  22. DoCmd.Close acForm, "ClientEntry"
  23. End If
  24. End If
  25.  
  26. End Sub
May 24 '11 #1

✓ answered by Stewart Ross

Would the form on which this code is running be ClientEntry by any chance? If it is, then it would appear that the conditions in line 3 were satisfied (Me.ViewReferral = False And Me.ViewGen = True) for in that case the form is then closed in line 6 (DoCmd.Close acForm, "ClientEntry"). In these circumstances trying to execute line 8 will indeed lead to the error you are experiencing.

-Stewart

2 14685
Stewart Ross
2,545 Expert Mod 2GB
Would the form on which this code is running be ClientEntry by any chance? If it is, then it would appear that the conditions in line 3 were satisfied (Me.ViewReferral = False And Me.ViewGen = True) for in that case the form is then closed in line 6 (DoCmd.Close acForm, "ClientEntry"). In these circumstances trying to execute line 8 will indeed lead to the error you are experiencing.

-Stewart
May 24 '11 #2
Swapped my end if for Elseif and it's working. Thanks
May 25 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: CLarkou | last post by:
On a client's machine with Office 97, my access program gives an error "The Expression you entered refers to an object that is closed or doesn't exist" when I am assigning a value in the checkbox....
8
by: Bassem | last post by:
Hi to all... Thanks for the help... I want to get the value of the column of dataset into array, but I get this bug. "Cannot apply indexing with to an expression of type 'object'" when biuld....
3
by: Karel Vandenhove | last post by:
Hi, I get an error "cannot apply indexing with to an expression of type object" when I try to compile the code below. SSLScannerManager is a COM component. (Used to access fingerprint...
3
by: Adam J Knight | last post by:
Hi all, I am getting the following error with this if statement.. if(e.Item.DataItem != 2) { } //error Cannot apply indexing with to an expression of type 'object' Can someone fill me in on...
5
by: (PeteCresswell) | last post by:
I've got a parent form and three subforms. Two of them work A-OK. For the third one, in the Immediate window: ----------------------------------------- ?Me.subDeal.Name subDeal ...
10
by: desperateloser | last post by:
1st - This is likely pathetically simple and not at all what this site is for, being mostly a snafu using regular Acess stuff and not at all coding or scripting. Please be merciful - I'm really very...
1
by: sumit205 | last post by:
Error 2467:The Expression you entered refers to an object that is closed or doesn't exist . DoCmd.OpenForm frm2, WindowMode:=acDialog, OpenArgs:="c" & NewProductID In the debig mode when i...
2
by: iduniq | last post by:
Hi, Good day! I have a problem opening a shared mem, the error code of which is 2 (Object does not exist). This is my setup, a Windows service calls a process A, process A creates successfully...
6
by: weston | last post by:
In Access 2000 I have a form with a tab control with 3 tabs. I have a button that is supposed to check if each question on the form has been completed. The code that is under this button is below. It...
6
by: laconicamit | last post by:
HI!, Using SQL+, when i try to connect to a server giving RAC_srv as service name. It get connected, However sometimes it throws me following error. ORA-12545: Connect failed because target...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.