データ保存


[DAO]

  1. Dim DT As Date
  2. Dim rsw1 As DAO.Recordset
  3. Set rsw1 = CurrentDb.OpenRecordset("SELECT * FROM D_COLLATION", dbOpenDynaset)
  4.  
  5. DT = Now()
  6. rsw1.AddNew
  7. pubCOLLATION_ID = TBLID_INCL("D_COLLATION", "COLLATION_ID")
  8. rsw1.Fields("COLLATION_ID") = pubCOLLATION_ID
  9. rsw1.Fields("COL_WDATE") = Format(DT, "mm/dd/yyyy")
  10. rsw1.Fields("COL_WTIME") = Format(DT, "hh:nn:ss")
  11. rsw1.Fields("COL_EMPID") = pubEMPID
  12. rsw1.Update
  13. rsw1.Close
  14. Set rsw1 = Nothing
  15.  

  1. Public Function TBLID_INCL(TBLName As String, FLDName As String) As Long
  2. '概要: テーブルのIDフィールドのカウントアップ
  3.  
  4. '/ テーブルかフィールド名が指定されているか
  5. If IsNull(TBLName) = True Or IsNull(FLDName) = True Then
  6. MsgBox "There is no specification. ", vbExclamation, SOFTNAME
  7. Exit Function
  8. End If
  9.  
  10. '/ レコード数確認
  11. Select Case Nz(DCount("*", TBLName), 0)
  12. Case 0 '// レコード数ゼロ
  13. TBLID_INCL = 1
  14. Case Is > 0 '// レコード数ゼロより上
  15. TBLID_INCL = DMax(FLDName, TBLName) + 1
  16. End Select
  17.  
  18. End Function
  19.  






最終更新:2008年04月29日 18:06