Hello,
I am using a form which I had got from this site to Add/Copy/Paste folders and files. I modified the form to suit my needs and everything was working fine. I brought the database and folder containing reference material to work and set the folder(s) up on my net vice standalone/local drive and am getting Run Time Error 2176 "The setting for this proerty is too liong".
I have already used the form time and time again on the target folder(no new files so I know its not any larger then it was yesterday) and everything worked on the standalone which lead me to beleive it does not like a newwork enviorment. Having searched this fourm on similiar 2176 errors they seem to have a common thread of the form lists XX number of lines and then stops. In this case, the listbox never populates and the error is immediatly produced. Code is provided. Debugger stops on the line bolded. Any thoughts? thanks!
Private Sub cmdListDirFiles_Click()
If Me.txtDir = "" Then
MsgBox "Please select a folder first..", vbCritical, "No Folder selected"
Call cmdChooseDir_Click
If Me.txtDir = "" Then
MsgBox "No folder selected. Please try again...", vbCritical, "No Folder selected"
Exit Sub
End If
End If
'Code adapted from
'http://www.access-programmers.co.uk/forums/showthread.php?t=40205
'Code credit goes to IMO & JonK
Dim strFile As String, strRowSource As String
strFolderName = Me.txtDir
strFile = Dir(strFolderName & "\")
strRowSource = strRowSource & strFile & ";"
Do Until strFile = ""
strFile = Dir
strRowSource = strRowSource & strFile & ";"
Loop
If strRowSource <> ";" Then
Me.lstDirFiles.RowSource = Left(strRowSource, Len(strRowSource) - 1)
Me.lstDirFiles.Enabled = True
Me.lstDirFiles.SetFocus
Else
Me.lstDirFiles.RowSource = "Folder is EMPTY"
Me.lstDirFiles.Enabled = False
Me.cmdChooseDir.SetFocus
End If
'***************I added this******************************************
Dim db1 As DAO.Database
Dim rst1 As DAO.Recordset
Set db1 = CurrentDb
Set rst1 = db1.OpenRecordset("tblRecentFolder", dbOpenTable)
While Not rst1.EOF And Not rst1.BOF
rst1.Edit
rst1("RecentFolder") = Me.txtDir
rst1.Update
rst1.MoveNext
Wend
End Sub
I am using a form which I had got from this site to Add/Copy/Paste folders and files. I modified the form to suit my needs and everything was working fine. I brought the database and folder containing reference material to work and set the folder(s) up on my net vice standalone/local drive and am getting Run Time Error 2176 "The setting for this proerty is too liong".
I have already used the form time and time again on the target folder(no new files so I know its not any larger then it was yesterday) and everything worked on the standalone which lead me to beleive it does not like a newwork enviorment. Having searched this fourm on similiar 2176 errors they seem to have a common thread of the form lists XX number of lines and then stops. In this case, the listbox never populates and the error is immediatly produced. Code is provided. Debugger stops on the line bolded. Any thoughts? thanks!
Private Sub cmdListDirFiles_Click()
If Me.txtDir = "" Then
MsgBox "Please select a folder first..", vbCritical, "No Folder selected"
Call cmdChooseDir_Click
If Me.txtDir = "" Then
MsgBox "No folder selected. Please try again...", vbCritical, "No Folder selected"
Exit Sub
End If
End If
'Code adapted from
'http://www.access-programmers.co.uk/forums/showthread.php?t=40205
'Code credit goes to IMO & JonK
Dim strFile As String, strRowSource As String
strFolderName = Me.txtDir
strFile = Dir(strFolderName & "\")
strRowSource = strRowSource & strFile & ";"
Do Until strFile = ""
strFile = Dir
strRowSource = strRowSource & strFile & ";"
Loop
If strRowSource <> ";" Then
Me.lstDirFiles.RowSource = Left(strRowSource, Len(strRowSource) - 1)
Me.lstDirFiles.Enabled = True
Me.lstDirFiles.SetFocus
Else
Me.lstDirFiles.RowSource = "Folder is EMPTY"
Me.lstDirFiles.Enabled = False
Me.cmdChooseDir.SetFocus
End If
'***************I added this******************************************
Dim db1 As DAO.Database
Dim rst1 As DAO.Recordset
Set db1 = CurrentDb
Set rst1 = db1.OpenRecordset("tblRecentFolder", dbOpenTable)
While Not rst1.EOF And Not rst1.BOF
rst1.Edit
rst1("RecentFolder") = Me.txtDir
rst1.Update
rst1.MoveNext
Wend
End Sub