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

Error 2950 creating new directory

Status
Not open for further replies.

blacy

Technical User
Jun 17, 2000
16

After 2003 - 2007 office upgrade I have and event proceedure that creates a new directory on a drive. WHen running the code I get an error 2950. I have alread trusted the drive and subdirectories. I am not sure if this is a problem because I am acting outside of office environment with the action of creating a new directory or if there is another problem. Any help would be great..


Private Sub Combo80_AfterUpdate()
On Error GoTo Err_Combo80_AfterUpdate
Dim strServerPath As String
Dim strNewDirectoryName As String
Dim strNewFullPathName As String
Dim strQuoteFormsPathName As String
Dim strQuoteFormsFileName As String


strNewDirectoryName = Me![QuoteRef]
strServerPath = DLookup("QuoteFilePath", "ZZCompanyInfoTable1", "CompanyID= " & 1)

strNewFullPathName = strServerPath & strNewDirectoryName

strQuoteFormsPathName = DLookup("QuoteFormsPath", "ZZCompanyInfoTable1", "CompanyID= " & 1)

strQuoteFormsFileName = "PanelmaticQuote1.xls"

DoCmd.RunMacro "Quote Form Macros.Set Company"

MkDir strNewFullPathName
Me.QuoteFilePath = strNewFullPathName


Dim fs As Object
Set fs = CreateObject("scripting.filesystemobject")
If fs.FileExists(strQuoteFormsPathName & strQuoteFormsFileName) Then
fs.CopyFile strQuoteFormsPathName & strQuoteFormsFileName, strNewFullPathName & "\" & strNewDirectoryName & ".xls", True
End If
Set fs = Nothing
Me.Refresh

Exit_Combo80_AfterUpdate:
Exit Sub

Err_Combo80_AfterUpdate:
MsgBox "Directory already exist"

End Sub
 
Your DLookup calls look as if there is something wrong - they only filter on the Company ID to a fixed value, so always will return the same data:

eg:
strServerPath = DLookup("QuoteFilePath", "ZZCompanyInfoTable1", "CompanyID= " & 1)

The & 1 means whatever you get will be the same regardless of selected company details on your combo box.

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top