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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error when running db on another machine

Status
Not open for further replies.

thegameoflife

Programmer
Dec 5, 2001
206
US
When I tried to run the code below on another computer I got a read only error on the export. Any ideas?

Code:
Private Sub Command31_Click()

Dim exlpathH As String
Dim exlpathA As String
Dim x

DoCmd.SetWarnings False
x = Me.cmbDate.Value

exlpathH = "C:\Recoveries\HRI Recoveries for " & x & ".xls "
exlpathA = "C:\Recoveries\AIM Recoveries for " & x & ".xls "


    If Me.optHRI.Value = -1 Then
        
        DoCmd.OpenQuery "QRY_Exprt_HRI"
        DoCmd.TransferSpreadsheet acExport, 8, "Tbl_HRI_Export", exlpathH, True, ""
        
    End If
    
    
    If Me.optAIM.Value = -1 Then
        
        DoCmd.OpenQuery "QRY_Exprt_AIM"
        DoCmd.TransferSpreadsheet acExport, 8, "Tbl_AIM_Export", exlpathA, True, ""
        
    End If


End Sub
 
If you were trying to remotely access the file, the file sharing settings could be restricted to read only. ~~ Laziness is the mother of invention ~~
 

I tried creating a new export in code on the other machine and it worked fine without the "exlpathH" shown below.

the error said the database object was not updateable.
Code:
exlpathH = "C:\Recoveries\HRI Recoveries for " & x & ".xls "


If Me.optHRI.Value = -1 Then
        
        DoCmd.OpenQuery "QRY_Exprt_HRI"
        DoCmd.TransferSpreadsheet acExport, 8, "Tbl_HRI_Export", exlpathH, True, ""
        
    End If
 
I found the error

Code:
exlpathH = "C:\Recoveries\HRI Recoveries for " & x & ".xls "

for some reason the other machine did not like the space after .xls ".
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top