Updating Buttons from 2007 -2010 (1 Viewer)

Robb58

Registered User
Joined
Sep 4, 2014
Messages
28
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:
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:

CJ_London

Super Moderator
Staff member
Joined
Feb 19, 2013
Messages
11,595
nothing stands out, not the sort of code that would change from 2007 to 2010

which line(s) are causing the compile error? And what is the error description?
 

Robb58

Registered User
Joined
Sep 4, 2014
Messages
28
I think I've solved the problem - it had nothing to do with the button VBA code. When opening the db I was getting an error saying
Your MS Access database or project contains a missing or broken reference to the file 'MSCAL.OCX' version 7.0
Basically the database was looking for a calendar control which doesn't exist in Office 2010. I went into Visual Basic Editor, selected tools/references and cleared the "MISSING calendar control" check box. I restarted the DB and all was fine!

Thanks for looking at the problem CJ London
 

CJ_London

Super Moderator
Staff member
Joined
Feb 19, 2013
Messages
11,595
if not done already, to use the 2010 calendar control, ensure you set the format property of the date control(s) to shortdate or similar and the show dates property is set to 'For Dates'
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom