Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 09-09-2016, 12:41 AM   #1
Robb58
Newly Registered User
 
Join Date: Sep 2014
Posts: 17
Thanks: 10
Thanked 0 Times in 0 Posts
Robb58 is on a distinguished road
Updating Buttons from 2007 -2010

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 by Robb58; 09-09-2016 at 12:47 AM.
Robb58 is offline   Reply With Quote
Old 09-09-2016, 12:56 AM   #2
CJ_London
Super Moderator
 
Join Date: Feb 2013
Location: UK
Posts: 10,433
Thanks: 40
Thanked 3,367 Times in 3,262 Posts
CJ_London is just really nice CJ_London is just really nice CJ_London is just really nice CJ_London is just really nice CJ_London is just really nice
Re: Updating Buttons from 2007 -2010

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?
__________________
CJ_London
_______________________
A little thanks goes a long way. If you have found this post useful, please tick the thanks button
CJ_London is offline   Reply With Quote
The Following User Says Thank You to CJ_London For This Useful Post:
Robb58 (09-09-2016)
Old 09-09-2016, 01:11 AM   #3
Robb58
Newly Registered User
 
Join Date: Sep 2014
Posts: 17
Thanks: 10
Thanked 0 Times in 0 Posts
Robb58 is on a distinguished road
Re: Updating Buttons from 2007 -2010

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
Quote:
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

Robb58 is offline   Reply With Quote
Old 09-09-2016, 01:47 AM   #4
CJ_London
Super Moderator
 
Join Date: Feb 2013
Location: UK
Posts: 10,433
Thanks: 40
Thanked 3,367 Times in 3,262 Posts
CJ_London is just really nice CJ_London is just really nice CJ_London is just really nice CJ_London is just really nice CJ_London is just really nice
Re: Updating Buttons from 2007 -2010

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'

__________________
CJ_London
_______________________
A little thanks goes a long way. If you have found this post useful, please tick the thanks button
CJ_London is offline   Reply With Quote
Reply

Tags
access 2010 , button , folder , vba

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it possible to use a custom control made in VS 2010 in Access 2007/2010 forms? iloovatar VB.NET 1 03-03-2016 02:00 PM
Any Risk Updating 2003 DB mdb to 2007 accdb (Already Running 2007) bignose2 General 1 05-08-2015 12:50 AM
Tab buttons not displayed in Access 2010 mlai08 Forms 0 10-18-2012 06:18 AM
Updating a recordset in Access 2010 with an Excel 2010 userform cjohnson78 Modules & VBA 1 04-03-2012 05:55 PM
Subform's Conditional Formatting Not Updating on Data Change - Access 2007 and 2010 M_S_Jones Forms 5 10-21-2011 01:17 AM




All times are GMT -8. The time now is 11:02 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Sponsored Links

How to advertise

Media Kit


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World