invalid procedure???

tdubs

Registered User.
Local time
Today, 11:04
Joined
May 30, 2006
Messages
27
Hi, I have this code to find tables already in my DB and delete them if found.
When I use my program in my laptop it works peferectly
when I use it in my supervisor's laptop it doesnt as it pops up a message box saying invalid argument or proccedure......

any idea on what is going on? is it a library or smth??

desperate for help.....Thanks

Code:
Dim OBJ As AccessObject, DBS As Object
Set DBS = Application.CurrentData

' Search for open AccessObject objects in AllTables collection and delete
    For Each OBJ In DBS.AllTables
    If OBJ.Name = "IODB" Then
        'Table was found, ask user what to do
    UserResponse = MsgBox("Another Wire Table Was Found. Do You Wish To Replace it with Your File?", vbOKCancel, "Table Found")
         
      If UserResponse = 2 Then 'User Response is Cancel
      MsgBox ("Update IO Table was Cancelled!!!")
      Exit Sub
      
      ElseIf UserResponse = 1 Then 'User Response is ok. Then delete and transfer new table
        DoCmd.DeleteObject acTable, "IODB"
        
      End If
    Else
  
    End If
    Next OBJ
 
Oldsoftboss said:
Check the VBA references and Access / Office versions

Thanks, I checked the libraries and my supervisors laptop's have all the libraries I have as well...

Another thing I think it mite be is that when I open the program in my suspervisors laptop, access says somethinga bout blocking unsafe expressions... I tried lowering the macro security, however it didn't work as I am not even using macros....

there is one way that worked...which is modifying the code.. but the modification is a bit weird and not well supported...

I get the error in the line " If OBJ.Name = "IODB" Then"
So I passed the variable like this:

Code:
Dim OBJ As AccessObject, DBS As Object
Set DBS = Application.CurrentData

' Search for open AccessObject objects in AllTables collection and delete
    For Each OBJ In DBS.AllTables
      xx = OBJ.Name

    If xx = "IODB" Then
        'Table was found, ask user what to do
    UserResponse = MsgBox("Another Wire Table Was Found. Do You Wish To Replace it with Your File?", vbOKCancel, "Table Found")
         
      If UserResponse = 2 Then 'User Response is Cancel
      MsgBox ("Update IO Table was Cancelled!!!")
      Exit Sub
      
      ElseIf UserResponse = 1 Then 'User Response is ok. Then delete and transfer new table
        DoCmd.DeleteObject acTable, "IODB"
        
      End If
    Else
  
    End If
    Next OBJ

xx is not even declare and it works... when I declare it as a string... it doesnt


Anyone have an idea on what is going on and how can I fix it?.... Thanks in advance
 

Users who are viewing this thread

Back
Top Bottom