Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Over the past year I have found your site to be EXCELLENT. Never have I been able to find so many answers to such vast problems and it is an excellent service..."

Geography

Where in the world do Tek-Tips members come from?
Triacona (TechnicalUser)
5 Jul 12 5:26
Dear All,

I have a problem that started yesterday.
I have had these functions and they have worked for the last 8-10 months, but yesterday I got the following error, after clicking my Run Report or Run Query Button.

Quote (Error 2467)

Run-time error '2467' The Expression you entered refers to an object that is closed or doesn't exist
The Functions are:

CODE

Function QueryExists(stDocName As String) As BooleanOn 

Error Resume Next 

QueryExists = (CurrentDb.QueryDefs(stDocName).NAME = stDocName)

End Function

Function ReportExists(stDocName As String) As BooleanOn 

Error Resume Next

ReportExists = (CurrentProject.AllReports(stDocName).NAME = stDocName)

End Function 
It might be a references problem, are there right and wrong references to use in VB?
Please help this is so frustratingsadeyes
Thank you smile
Just in case the code above bunches when I submit:
Function QueryExists(stDocName As String) As BooleanOn

Error Resume Next


QueryExists = (CurrentDb.QueryDefs(stDocName).NAME = stDocName)

End Function

Function ReportExists(stDocName As String) As BooleanOn

Error Resume Next


ReportExists = (CurrentProject.AllReports(stDocName).NAME = stDocName)

End Function

Thank you,

Kind regards

Triacona

Triacona (TechnicalUser)
5 Jul 12 6:48
Dear All,

I have removed a few references and I have now the following error:

Quote (Run-time error '3265':)

Run-time error '3265': Item not found in this collection

Here is a list of my references:
Visual Basic For applications
Microsoft Access 11.0 Object Library
CAPS Functions
Microsoft DAO 3.6 Object Library

Thank you for your forthcoming help smile

Thank you,

Kind regards

Triacona

MajP (TechnicalUser)
5 Jul 12 7:44
most likely your name is incorrect. Assume a query def is "qryOne" and you pass "queryOne". Since the item "queryOne" does not exist in the query def collection you get the error.
Triacona (TechnicalUser)
5 Jul 12 9:29
Dear PHV,

Thanks, but I do have the ON before: error resume next smile I just left it out by mistake when I posted, sorry.

@MajP It just keeps giving me an error, saying it is not there, which I know but have code within the button to determine that.

I originaly got the Function code from Tek-Tips.

I use the Functions within my buttons i.e.
That produces a msgbox saying the report does not exist, as below.

This was working for 8-10 months, I don't know if my IT dept changed anything, but they have not found out yet.

I have listed my current references for the project above.

CODE

Private Sub SrRunQuery_Click()
'*SERVICE REQUEST SR RUN QUERY BUTTON**********
On Error GoTo Err_SrRunQuery_Click

    Dim stDocName As String
        stDocName = ListSR.Column(2)

    If Not QueryExists(stDocName) Then
        msgbox stDocName & " query doesn't exist, RUN the REPORT!", vbExclamation, "Run The REPORT!!!"
    ElseIf Not Me.SubFrmInput.Form.txtEndDate.Enabled = True Then
        DoCmd.OpenQuery stDocName, acNormal, acEdit
    ElseIf IsNull(Me.SubFrmInput.Form.txtStartDate And Me.SubFrmInput.Form.txtEndDate) Then
            DoCmd.RunMacro "MsgBoxNoDate"
    Else: DoCmd.OpenQuery stDocName, acNormal, acEdit
            
    End If 'If Not QueryExists(stDocName) Then
    
Exit_SrRunQuery_Click:
    Exit Sub

Err_SrRunQuery_Click:
    msgbox Err.Description
    Resume Exit_SrRunQuery_Click
    
End Sub 

Any help you can give would be greatly appreciated!smile
This is really getting me down, it worked once...sadeyes
Thank you again for all your help.

Thank you,

Kind regards

Triacona

Helpful Member!  dhookom (Programmer)
5 Jul 12 15:39
Have you set your code to Break On All Errors?

Duane
Hook'D on Access
MS Access MVP

Triacona (TechnicalUser)
6 Jul 12 4:45
Thank you all for you wonderful help! 2thumbsup Great forum!
@Duane:
Thannks that did seem to be the problem, and it works now.
Within VB I clicked:
Options -> General Tab -> I Changed Break on All Errors to Break on Unhandled Errors.

Thanks again for all your help.
Also to note I did not change the above options, but my Citrix profile was going a bit wonky.

My Citrix Profile might have to be reset.

But after changing this it all seemed to work.

Thanks again all - MajP; PHV; and Duane. bigsmile
Have a star Duane! smile

Thank you,

Kind regards

Triacona

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close