Results 1 to 4 of 4
  1. #1
    Ekhart is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jun 2016
    Posts
    80

    Trying to force updates on Database

    When I make updates to the database, I am trying to set up a simple button that I can push which will update the version number and force users to download the new copy. Right now I have a table for 'CurrentVersion' and I have a textbox on the loading screen with that versions number. If the 2 don't match, it pops up a message box and forces them to download the new copy before they can log in.

    Right now I have a button on my admin sheet which automatically updates the table field CurrentVersion, and I have tried to have it also update the 'default value' for the text field VersionTxt on the frmLogin form (the initial screen that loads). This never seems to work, the default value does not update. I can go in and manually do this but was trying to have all of these fields update with the 1 button. Problem being if I forget to update this manually and people go to download the 'new' version, it would still have the old number on it and then not open even though it really is the new version but the version number is wrong.



    I have tried using labels as well but could not get the code from the button to compare that to the CurrentVersion field from the tblVersionServer table.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Have you tried to requery the TextBox?

  3. #3
    Ekhart is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jun 2016
    Posts
    80
    So here is my code to try and update the default value... maybe it is wrong as it just doesn't do it.

    Code:
    Dim CurVer As String
    Me.CurrentVersion = Me.CurrentVersion.Value + 0.01 'Updates the CurrentVersion on the tblVersionServer table
    DoCmd.Save
    CurVer = Me.CurrentVersion
    Forms!frmLogin!VersionTxt.DefaultValue = CurVer ' Attempting to update the Default Value for the VersionTxt box on the frmlogin form.
    DoCmd.Close
    DoCmd.Requery
    MsgBox "Database Version Updated"

  4. #4
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,471
    Another Option that I use, create a .bat file or VB exe which is the code below, so when clicked it downloads a copy of the FE database to a folder on their local PC, then it looks for the version of Access they are using and opens the database using that version. So whenever you update the database, you just copy it to the network folder replacing the current one and next time they click the button to open the database, it will always download the latest copy. Here is example (first part checks to see if the program is already open):

    Private Sub Form_Load()
    On Error GoTo ErrTrap
    AppActivate "SMM System"
    Form1.Hide
    MsgBox "The SMM System is already open.", vbSystemModal
    Unload Form1
    Set Form1 = Nothing
    End

    CopyAndLoad:
    If Dir("c:\SMM", vbDirectory) = "" Then MkDir ("c:\SMM")
    FileCopy "\\apps\apps\smm\SMM.accdb", "c:\SMM\SMM.accdb"

    If Dir("C:\Program Files (x86)\Microsoft Office\OFFICE12\MSACCESS.EXE", vbDirectory) <> "" Then
    Shell "C:\Program Files (x86)\Microsoft Office\OFFICE12\MSACCESS.EXE c:\SMM\SMM.accdb", vbNormalFocus
    Else
    If Dir("C:\Program Files\Microsoft Office\OFFICE12\MSACCESS.EXE", vbDirectory) <> "" Then
    Shell "C:\Program Files\Microsoft Office\OFFICE12\MSACCESS.EXE c:\SMM\SMM.accdb", vbNormalFocus
    Else
    If Dir("C:\Program Files\Microsoft Office\Office14\MSACCESS.EXE", vbDirectory) <> "" Then
    Shell "C:\Program Files\Microsoft Office\Office14\MSACCESS.EXE c:\SMM\SMM.accdb", vbNormalFocus
    Else
    If Dir("C:\Program Files (x86)\Microsoft Office\Office14\MSACCESS.EXE", vbDirectory) <> "" Then
    Shell "C:\Program Files (x86)\Microsoft Office\Office14\MSACCESS.EXE c:\SMM\SMM.accdb", vbNormalFocus
    Else
    MsgBox "Could Not Find Microsoft Access Progrm. Please contact Support Group.", vbSystemModal
    End If
    End If
    End If
    End If
    Unload Form1
    Set Form1 = Nothing
    End
    Exit Sub

    ErrTrap:
    Select Case Err.Number
    Case 5
    GoTo CopyAndLoad
    Case 70
    MsgBox "Could Not Copy Current Version", vbSystemModal
    Unload Form1
    Set Form1 = Nothing
    End
    End Select
    End Sub

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Kick People out of the Database to make updates
    By Ian Frost in forum Security
    Replies: 5
    Last Post: 09-29-2016, 08:31 AM
  2. Replies: 2
    Last Post: 01-11-2013, 01:19 PM
  3. Replies: 1
    Last Post: 11-18-2012, 06:24 PM
  4. Replies: 10
    Last Post: 11-12-2010, 05:17 PM
  5. Database Updates
    By avarusbrightfyre in forum Programming
    Replies: 1
    Last Post: 09-15-2010, 02:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums