ray88’s diary

お仕事で困ったとき用の自分用の覚書

TEMP 覚書

Dim strRes As String
      
    If IsNull(Me.Controls("txb_FolderPath")) Then
        strRes = MsgBox("関連書類格納フォルダはなしでよろしいですか?", vbYesNo, "関連書類有無フォルダ有無確認")
    End If
    
    If strRes = vbNo Then
        MsgBox "関連書類格納フォルダを選択後再実行してください"
        Exit Sub
    Else
        Me.txb_FolderPath = "なし"
    End If
Dim strSQL As String
  Dim strResult As String
  Dim lngMaxSyouninInfoNum As Long
  Dim lngKaifuInfoNum As Integer
  Dim intAuthorizerKaifuNum As Integer
  Dim intMaxKaifuNum As Integer
  
  Call DeleteTableData("W_回付情報")
  '承認対象の申請IDの回付者情報をDBファイルからW_回付情報へインポート
    strSQL = "SELECT * FROM Q_回付情報 WHERE 申請ID = " & Me.cmb_SinseiID & ";"
    Debug.Print strSQL
        strResult = fncImportDbTable(strSQL, "W_回付情報", 5)
    Debug.Print strResult
    '---------------------------------------------------------------------------
    'W_回付情報より回付番号の最大値を取得
    intMaxKaifuNum = DMax("回付番号", "W_回付情報")
    lngMaxSyouninInfoNum = DMax("承認情報ID", "W_承認履歴", "申請ID= " & Me.cmb_SinseiID)
    lngKaifuInfoNum = DLookup("回付情報ID", "W_承認履歴", "承認情報ID=" & lngMaxSyouninInfoNum)
    intAuthorizerKaifuNum = DLookup("回付番号", "W_回付情報", "回付情報ID=" & lngKaifuInfoNum)
    Debug.Print "回付番号最大値" & intMaxKaifuNum
    
    Call DeleteTableData("W_回付情報")
    
    If intMaxKaifuNum = intAuthorizerKaifuNum Then
        Me.frm_SelctMail.Visible = True
        Me.lbl_SelectMailInfo.Visible = True
        MsgBox "最終承認者"
    Else
        Me.frm_SelctMail.Visible = False
        Me.lbl_SelectMailInfo.Visible = False
    End If


f:id:ray88:20210214121200p:plain

Option Compare Database
Option Explicit

Private Sub btn_Close_Click()
    DoCmd.Close acForm, "F_スタート", acSaveNo
    'アプリケーションを終了する
    Application.Quit
End Sub

Private Sub btn_OK_Click()
    DoCmd.OpenForm "F_メニュー", acNormal, , , , acWindowNormal
     DoCmd.Close acForm, "F_スタート", acSaveNo

   
End Sub

Private Sub Form_Load()
    Dim strPath As String
    Dim Fso As Object
    Dim blUsedFile As Boolean
    Dim strFileName As String

    strPath = CurrentProject.Path
    strPath = strPath & "\使用中確認用"
    
    Set Fso = CreateObject("Scripting.FileSystemObject")
    
    strFileName = Dir(strPath)
    
    If Not fncIsExistsDir(strPath) Then
        MkDir strPath
    End If
    
    If Not fncIsExistsFile(strPath & "\②承認ツール.txt") Then
         blUsedFile = False
        Fso.CreateTextFile (strPath & "\②承認ツール.txt")
    Else
        blUsedFile = True
    End If
    
    If blUsedFile Then
        Me.lblUsed.Visible = True
        Me.lblGoToMenu.Visible = False
        Me.btn_Close.Visible = True
        Me.btn_Close.Enabled = True
        Me.btn_OK.Visible = False
        Me.btn_OK.Enabled = False
    Else
        Me.lblUsed.Visible = False
        Me.lblGoToMenu.Visible = True
        Me.btn_Close.Visible = False
        Me.btn_Close.Enabled = False
        Me.btn_OK.Visible = True
        Me.btn_OK.Enabled = True
    End If
    
    'ナビゲーションウィンドウを非表示にする
    DoCmd.SelectObject acForm, "", True
    DoCmd.RunCommand acCmdWindowHide

    'ナビゲーションボタンを非表示にする
    Me.NavigationButtons = False
    'レコードセレクタを非表示にする
    Me.RecordSelectors = False
    
    'リボンを隠す
    DoCmd.ShowToolbar "Ribbon", acToolbarNo
        
End Sub

Private Sub Form_Unload(Cancel As Integer)
    'アプリケーションを終了する
'    Application.Quit
End Sub