Results 1 to 3 of 3
  1. #1
    vicsaccess's Avatar
    vicsaccess is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    451

    form on load event

    i have a form that opens, checks the version of the FE and updates if need be. if the version is equal than it runs thru a case select and selects the form to open based on the users level. i am trying to have this open form open in the background as it has the users ID, location and level already open so that each form that loads on top of it pulls these items from the start form rather than re pulling the data. my problem is that when i step thru the code it works great till it gets to the end then it pulls the start form back on top of the form picked out to load. can someone pick out what i'm doing wrong with this code or inform me of a better way.



    Code:
    Private Sub Form_Load()
        Dim x As String
        x = fOSUserName
        Me.txtdsid = x
        Me.txtversion = DLookup("version", "versiont")
        Me.txtloc = DLookup("locationid", "2lognamet", "DsID='" & Me.txtdsid & "'")
        Me.txtlev = DLookup("lev", "2lognamet", "dsid='" & Me.txtdsid.Value & "'")
        y = Me.txtversion <> Me.lblversion.Caption
        Select Case y
            Case Is = True
                CreateObject("Scripting.FileSystemObject").CopyFile _
                "S:\shared\ssc\Share\SSCMaintenance\Maint. Master\MasterFE\maintenance.accdb", "C:\Users\" & x & "\Desktop\maintenance.accdb", True
                'allow enough time for file to completely copy before opening
                Dim Start As Double
                Start = Timer
                While Timer < Start + 20
                DoEvents
                Wend
                    'load new version - SysCmd function gets the Access executable file path
                    'Shell function requires literal quote marks in the target filename string argument, hence the quadrupled quote marks
                Shell SysCmd(acSysCmdAccessDir) & "MSAccess.exe " & """" & CurrentProject.FullName & """", vbNormalFocus
                    'close current file
                DoCmd.Quit
            Case Is = False
                Select Case Me.txtlev
                Case Is = ""
                    DoCmd.BrowseTo acBrowseToForm, "newlogf"
                Case Is = 1
                    DoCmd.OpenForm "entryf", acNormal
                Case Is = 2
                    DoCmd.OpenForm "entryformf", acNormal
                Case Is = 3
                    DoCmd.OpenForm "entryformf", acNormal
                End Select
            End Select
      End Sub

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,926
    Is the start form set as popup or modal?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,800
    change
    acNormal to acHidden?

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

Similar Threads

  1. Replies: 1
    Last Post: 12-23-2015, 08:45 AM
  2. Replies: 13
    Last Post: 09-10-2015, 03:37 PM
  3. Replies: 2
    Last Post: 04-17-2015, 10:59 AM
  4. Replies: 1
    Last Post: 03-29-2014, 07:46 PM
  5. Form Load Event
    By shah1419 in forum Forms
    Replies: 5
    Last Post: 01-13-2013, 12:42 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