Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / November 2006

Tip: Looking for answers? Try searching our database.

run-time error 2467

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Cyberwolf - 01 Nov 2006 16:35 GMT
I have a form that has a check box in the form footer called chkTBArchive.  I
have a button on the same form footer that runs code that uses this check box
to run or not run specific queries based on its value.  When I clikc the
button the code runs up to this point and errors out with a run-time error
2467 "The expression you entered refers to an object that is closed or
doesn't exist.

The strange thing is that I pulled this code from another form that contains
the same coding but the check box is part of the main form and is not on the
form footer.

Any help would be greatly appreciated.  see code below

Private Sub butTBOps_Click()
'On Error GoTo Err_butTBOps_Click
   
   Dim stDocName As String
   Dim stDocName1 As String
   Dim stDocName2 As String
   Dim stDocName3 As String
   Dim stDocName4 As String
   Dim stDocName5 As String
   Dim stDocName6 As String
   Dim stDocName7 As String
   Dim intResponse As Integer
           
   Dim xlApp As New Excel.Application
   Dim xlWkb As Excel.Workbook
   
       DoCmd.Close acForm, "frm:Current TB", acSaveNo
           
   DoCmd.RunMacro "mac:DelWalTB"
   
   Set xlApp = New Excel.Application
   Set xlWkb = xlApp.Workbooks.Open("G:\Accounting\AR\AR
Database\Macros.xls", 0)
   xlApp.Visible = True
   xlWkb.Windows(1).Visible = True
   
   xlWkb.Application.Run ("Import_TB")
   
   xlWkb.Close savechanges:=False
   Set xlWkb = Nothing
   xlApp.Quit
   Set xlApp = Nothing
 
       
' This Deletes the info in the Old TB Table
   stDocName2 = "qry:Del Old TB"
   DoCmd.OpenQuery stDocName2, acViewNormal, acEdit
' This Copies the info From the Current TB to the Old TB
   stDocName3 = "qry:Current TB to Old TB"
   DoCmd.OpenQuery stDocName3, acNormal, acEdit
' This deletes the info in the Current TB
   stDocName4 = "qry:Del Current TB"
   DoCmd.OpenQuery stDocName4, acViewNormal, acEdit
' This Transfers the Delimited text file to the Current TB
   DoCmd.TransferText acImportDelim, "kal-wal tb Import Specification",
"Current TB", "\\Pasvr\Group\Accounting\AR\AR Database\kal-wal TB.txt", True
' Copies the Old TB Status Info to the Current TB
   stDocName5 = "qry:Update Current TB"
   DoCmd.OpenQuery stDocName5, acViewNormal, acEdit

' This will copy the Old TB to the Archive TB if the Check box is checked
       If chkTBArchive = True Then
           stDocName = "qry:TB Archive"
           DoCmd.OpenQuery stDocName, acNormal, acEdit
' This will add the week nunmber to the Archive TB
           stDocName1 = "qry:TB Archive Week Update"
           DoCmd.OpenQuery stDocName1, acViewNormal, acEdit

   
       End If

'Message to state the Trial balance is loaded

MsgBox "The Current Trial Balance has been loaded.", vbOKOnly, "File
Operation Complete"
   
'Reopens the Current Trial Balance form

   DoCmd.OpenForm "frm:Current TB", acNormal, , , acFormEdit, acWindowNormal
   
Exit_butTBOps_Click:
   Exit Sub

Err_butTBOps_Click:
   MsgBox Err.Description
   Resume Exit_butTBOps_Click

End Sub

Signature

James Gaylord
Finder of Paths, Hunter of Prey
Ghost of the Night, Shadow of Day
The Wolf

Ralph - 01 Nov 2006 20:45 GMT
Looks like you are closing your form with the check box before you run the
queries..

> I have a form that has a check box in the form footer called chkTBArchive.  I
> have a button on the same form footer that runs code that uses this check box
[quoted text clipped - 87 lines]
>
> End Sub
Cyberwolf - 01 Nov 2006 20:48 GMT
That did it.  Sometimes it is the simplest things that get you.  I should
have noticed this right off the top.

Thanks!!
Signature

James Gaylord
Finder of Paths, Hunter of Prey
Ghost of the Night, Shadow of Day
The Wolf

> Looks like you are closing your form with the check box before you run the
> queries..
[quoted text clipped - 90 lines]
> >
> > End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.