I've got a database which worked in Access 2007 but opening it up in 2010 throws up a couple of compile errors.
I have a "Jobs" form which I use to book work into and within the form I use two buttons for folder creation and folder viewing.
When I click the "CreateFolder" button a new folder is created in a specified "Jobs" folder. The Folder takes its name from a "JobNumber" field. I then use the folder to store all files relevant to the job.
The "View_Folder" button opens the relevant folder in explorer based on the "JobNumber" field.
When running the database in Access 2010 these buttons no longer function and throw up a compile error. The VBA code attached to the Create button is:
and the view folder button is:
Any help would be much appreciated
I have a "Jobs" form which I use to book work into and within the form I use two buttons for folder creation and folder viewing.
When I click the "CreateFolder" button a new folder is created in a specified "Jobs" folder. The Folder takes its name from a "JobNumber" field. I then use the folder to store all files relevant to the job.
The "View_Folder" button opens the relevant folder in explorer based on the "JobNumber" field.
When running the database in Access 2010 these buttons no longer function and throw up a compile error. The VBA code attached to the Create button is:
Code:
Private Sub CreateFolder_Click()
' In Microsoft Windows:
' Specifying 1 as the second argument opens the application in
' normal size and gives it the focus.
Dim RetVal
Dim FolderName As String
FolderName = Format(Me.Job_Number, "00000")
RetVal = Shell("cmd.exe /C color 4e && md G:\Graphics\Jobs\" & FolderName, 1) ' Create graphics Job folder.
MsgBox "The folder G:\Jobs" & FolderName & " has been created. You should use this folder to store all files related to this finished Job. When the job is complete ensure you clear up any other files stored on the network, so as to conserve storage space.", vbOKOnly, "Folder Created"
End Sub
and the view folder button is:
Code:
Private Sub View_Folder_Click()
Dim RetVal
Dim FolderName As String
FolderName = Format(Me.Job_Number, "00000")
RetVal = Shell("explorer G:\Graphics\jobs\" & FolderName, 1) ' View Job folder
End Sub
Any help would be much appreciated
Last edited: