Forcing Users To Update

JRinderer

New Member
Joined
Dec 1, 2015
Messages
17
Hello all, I've got a bit of code in Excel I've used to automate opening a website and clicking various objects. I've worked a lot in Excel VBA, but Access VBA is still new, so I've got some of this completed; but I'm having trouble with the last half.

Goals:
  1. On opening the Access file I want the program to go to a SharePoint site and check to see that the users file name matches mine.
    1. I have the code to go to the SharePoint site and get the name of the file on SharePoint and then store it into a variable.
    2. I need code to grab the file name of the users application (the Access file).
    3. I know how, in Excel, to write code that will run when the user opens the file
      Code:
      Workbook_Open()
      ; but I can't figure it out in Access.
  2. If the users file name doesn't match mine I want a message box to appear telling the user to download the most recent file. I then want to close the application down
    1. I have code for the message box.
    2. I am still unsure how to reference the Access application itself to close it. Application.close? Can I set an Access object like I can in Excel?
Code:
[INDENT=2]
Dim wB as workbookSet[/INDENT]
[INDENT=2]Set Wb = Thisworkbook
Wb.close[/INDENT]
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Check out creating an AutoExec macro:
https://support.office.com/en-us/ar...database-98BA1508-DCC6-4E0F-9698-A4755E548124
http://www.databasedev.co.uk/autoexec-macro.html

This is one of the cases were we must point out that Access Macros are not simply vba macros but a specific feature in Access that you create using the Macro Designer, not just inserting a module and putting subs or functions in it. Your AutoExec macro can run a vba function in turn, using the RunCode operation.

I would also suggest using a Macro for your shutdown function as well. Just create a macro with a QuitAccess operation. You can call your shutdown macro with vba using DoCmd.RunMacro "MacroName".

I have not personally used AutoExec - I go with another option, which is to create a form, make it hidden, then set it as the startup form for the application. The hidden form then executes the code I want to run in it's open event (including, if you like, starting up another hidden form that has other code in its open event ...). However, I think AutoExec is well known and used successfully so either way is fine.

Note:
I cannot give advice on "forcing" users to do anything, so it is possible that knowledgeable or determined users can bypass these options.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,221,827
Messages
6,162,202
Members
451,752
Latest member
freddocp

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top