diff --git a/M_omStartup.def b/M_omStartup.def index 47bd156..e423370 100644 --- a/M_omStartup.def +++ b/M_omStartup.def @@ -7,7 +7,7 @@ Option Explicit Public Function Main(Optional linkLocal As Boolean = False) As Integer Dim FormName As String - 'omUserFunctions.AuthenticateUser + omUserFunctions.AuthenticateUser 'omUserFunctions.UserLock omMSAccessFunctions.MinimizeNavigationPane @@ -18,6 +18,9 @@ Dim FormName As String FormName = "StockCheck_List" End If End If + If gUser.UserRole.Name = "User" Then + FormName = "Project_List" + End If DoCmd.OpenForm FormName End Function @@ -31,71 +34,73 @@ End Function Public Function LinkSSMADatabaseSQLODBC() As Variant omSSMAAConnector.LinkUsingSSMA ConnectionType:=SQLOBDC, SavePassword:=True, alwaysUpdate:=True End Function -Public Function SyncUserMain() As Boolean -Dim LastSyncUser As Variant -Dim makeConnection As Boolean - 'omSSMAAConnector.LinkUsingSSMA ConnectionType:=Default, alwaysUpdate:=True - gLogging.Enabled = True - Application.SetOption "Move after enter", 0 - Application.SetOption "Auto compact", False - If InStr(1, CurrentProject.Name, "mbi_client") > 0 Then - - gLogging.WriteToFile Description:="Startup > Main > mBI_Client=true" - omSSMAAConnector.UpdateSSMAConnectionString Group:="mBIClientUser" - gLogging.WriteToFile Description:="Startup > Main > mBI_Client=true > UpdateSSMAConnectionString for mBIClientUser" - - LastSyncUser = omDefaultFunctions.GetSystemDefault("LastSyncUser") - gLogging.WriteToFile Description:="Startup > Main > mBI_Client=true > LastSyncUser=" & LastSyncUser - - makeConnection = True - If LastSyncUser = GetCurrentUserName Then - gLogging.WriteToFile Description:="Startup > Main > mBI_Client=true > LastSyncUser = GetCurrentUserName" - - If IsTableLocal("Users") And IsTableLocal("UserRoles") Then - gLogging.WriteToFile Description:="Startup > Main > mBI_Client=true > LastSyncUser = GetCurrentUserName > IsTableLocal" - makeConnection = False - End If - End If - If makeConnection Then - MsgBox "Please make sure you are in the companies network or have an open VPN connection!", vbOKOnly - If IsConnectingPossible("Users") Then - OrderSheetSyncFunctions.SetupOrderSheet - - gLogging.WriteToFile Description:="Startup > Main > mBI_Client=true > makeConnection=true > isConnectingPossible(users)" - omSSMAAConnector.LinkUsingSSMA Group:="mBIClientUser", ConnectionType:=SQLNCLI, SavePassword:=True - gLogging.WriteToFile Description:="Startup > Main > mBI_Client=true > makeConnection=true > LinkUsingSSMA for mBIClientUser" - OrderSheetSyncFunctions.SyncData - gLogging.WriteToFile Description:="Startup > Main > mBI_Client=true > makeConnection=true > SyncData" - End If - Else - OrderSheetFunctions.LoginCurrentUserName - End If - If gCurrentOrderSheetUser.Active Then - gLogging.WriteToFile Description:="Startup > Main > mBI_Client=true > gCurrentOrderSheetUser.Active" - omDefaultFunctions.Initialize True - gLogging.WriteToFile Description:="Startup > Main > mBI_Client=true > gCurrentOrderSheetUser.Active > omDefaultFunctions.Initialize True" - DoCmd.OpenForm "OrderSheet_List" - gLogging.WriteToFile Description:="Startup > Main > mBI_Client=true > gCurrentOrderSheetUser.Active > OpenForm OrderSheet_List" - Else - omDefaultFunctions.SaveSystemDefault "LastSyncUser", Null - gLogging.WriteToFile Description:="Startup > Main > mBI_Client=true > SetDefault LastSyncUser=null" - - omSSMAAConnector.DeleteLinkTables - gLogging.WriteToFile Description:="Startup > Main > mBI_Client=true > DeleteLinkTables" - omSSMAAConnector.DeleteSSMAATables - gLogging.WriteToFile Description:="Startup > Main > mBI_Client=true > DeleteSSMAATables" - omSSMAAConnector.DeleteSSMAABackupTables - gLogging.WriteToFile Description:="Startup > Main > mBI_Client=true > DeleteSSMAABackupTables" - Application.SetOption "Auto compact", True - gLogging.WriteToFile Description:="Startup > Main > mBI_Client=true > SetOption Auto Compact=true" - DoCmd.Quit acQuitSaveNone - End If - Else - omSSMAAConnector.LinkUsingSSMA Group:="mBI", ConnectionType:=SQLNCLI, SavePassword:=True - DeleteSSMAABackupTables - omDefaultFunctions.Initialize True - DoCmd.OpenForm "Flow" - End If - 'gDefaults.Mode = ServerMode - 'gSystemDefaults.Mode = LocalMode -End Function \ No newline at end of file + +'Public Function SyncUserMain() As Boolean +'Dim LastSyncUser As Variant +'Dim makeConnection As Boolean +' 'omSSMAAConnector.LinkUsingSSMA ConnectionType:=Default, alwaysUpdate:=True +' gLogging.Enabled = True +' Application.SetOption "Move after enter", 0 +' Application.SetOption "Auto compact", False +' If InStr(1, CurrentProject.Name, "mbi_client") > 0 Then +' +' gLogging.WriteToFile Description:="Startup > Main > mBI_Client=true" +' omSSMAAConnector.UpdateSSMAConnectionString Group:="mBIClientUser" +' gLogging.WriteToFile Description:="Startup > Main > mBI_Client=true > UpdateSSMAConnectionString for mBIClientUser" +' +' LastSyncUser = omDefaultFunctions.GetSystemDefault("LastSyncUser") +' gLogging.WriteToFile Description:="Startup > Main > mBI_Client=true > LastSyncUser=" & LastSyncUser +' +' makeConnection = True +' If LastSyncUser = GetCurrentUserName Then +' gLogging.WriteToFile Description:="Startup > Main > mBI_Client=true > LastSyncUser = GetCurrentUserName" +' +' If IsTableLocal("Users") And IsTableLocal("UserRoles") Then +' gLogging.WriteToFile Description:="Startup > Main > mBI_Client=true > LastSyncUser = GetCurrentUserName > IsTableLocal" +' makeConnection = False +' End If +' End If +' If makeConnection Then +' MsgBox "Please make sure you are in the companies network or have an open VPN connection!", vbOKOnly +' If IsConnectingPossible("Users") Then +' OrderSheetSyncFunctions.SetupOrderSheet +' +' gLogging.WriteToFile Description:="Startup > Main > mBI_Client=true > makeConnection=true > isConnectingPossible(users)" +' omSSMAAConnector.LinkUsingSSMA Group:="mBIClientUser", ConnectionType:=SQLNCLI, SavePassword:=True +' gLogging.WriteToFile Description:="Startup > Main > mBI_Client=true > makeConnection=true > LinkUsingSSMA for mBIClientUser" +' OrderSheetSyncFunctions.SyncData +' gLogging.WriteToFile Description:="Startup > Main > mBI_Client=true > makeConnection=true > SyncData" +' End If +' Else +' OrderSheetFunctions.LoginCurrentUserName +' End If +' If gCurrentOrderSheetUser.Active Then +' gLogging.WriteToFile Description:="Startup > Main > mBI_Client=true > gCurrentOrderSheetUser.Active" +' omDefaultFunctions.Initialize True +' gLogging.WriteToFile Description:="Startup > Main > mBI_Client=true > gCurrentOrderSheetUser.Active > omDefaultFunctions.Initialize True" +' DoCmd.OpenForm "OrderSheet_List" +' gLogging.WriteToFile Description:="Startup > Main > mBI_Client=true > gCurrentOrderSheetUser.Active > OpenForm OrderSheet_List" +' Else +' omDefaultFunctions.SaveSystemDefault "LastSyncUser", Null +' gLogging.WriteToFile Description:="Startup > Main > mBI_Client=true > SetDefault LastSyncUser=null" +' +' omSSMAAConnector.DeleteLinkTables +' gLogging.WriteToFile Description:="Startup > Main > mBI_Client=true > DeleteLinkTables" +' omSSMAAConnector.DeleteSSMAATables +' gLogging.WriteToFile Description:="Startup > Main > mBI_Client=true > DeleteSSMAATables" +' omSSMAAConnector.DeleteSSMAABackupTables +' gLogging.WriteToFile Description:="Startup > Main > mBI_Client=true > DeleteSSMAABackupTables" +' Application.SetOption "Auto compact", True +' gLogging.WriteToFile Description:="Startup > Main > mBI_Client=true > SetOption Auto Compact=true" +' DoCmd.Quit acQuitSaveNone +' End If +' Else +' omSSMAAConnector.LinkUsingSSMA Group:="mBI", ConnectionType:=SQLNCLI, SavePassword:=True +' DeleteSSMAABackupTables +' omDefaultFunctions.Initialize True +' DoCmd.OpenForm "Flow" +' End If +' 'gDefaults.Mode = ServerMode +' 'gSystemDefaults.Mode = LocalMode +'End Function +' \ No newline at end of file