I am working on making folders for each crate in a table. I made a datasheet for and put the below code. However I continue to get a "Loop without DO" error.
Can anyone assist with what I have done wrong?
Can anyone assist with what I have done wrong?
Code:
Dim rs As DAO.Recordset
Dim strSQL As String
Dim strBookmark As String
Set rs = Me.RecordsetClone
rs.MoveFirst
strBookmark = rs.Bookmark
Do While Not rs.EOF
Dim DirName As String
Dim DirName2 As String
Dim Response As String
DirName2 = "C:\Project_Photos\" & [Forms]![Makedirform]![Crate UID]
DirName = "C:\Project_Photos\" & [Forms]![Makedirform]![Crate UID] & "\" & [Forms]![Makedirform]![Internal Package UID]
Set rs = Me.RecordsetClone
rs.MoveFirst
strBookmark = rs.Bookmark
Do Until rs.EOF
If Dir(DirName2, vbDirectory) = "" Then
MkDir DirName2
End If
If IsNull([Forms]![Makedirform]![Internal Package UID]) Then
rs.MoveNext
Loop
rs.Close
Me.Bookmark = strBookmark
Else
If Dir(DirName, vbDirectory) = "" Then
MkDir DirName
End If
rs.MoveNext
Loop
rs.Close
Me.Bookmark = strBookmark
Exit_Folder_with_Store:
Exit Sub
Err_Folder_with_Store:
MsgBox Err.Description
Resume Exit_Folder_with_Store
End Sub