| 
Option Compare Database
Option Explicit
Function sam0501()
    Dim dbs As Database
    Dim rst As Recordset
    Dim strSQL As String
    Dim cntrec As Integer
    Set dbs = CurrentDb()
    strSQL = "SELECT * FROM [catalog];"
    Set rst = dbs.OpenRecordset(strSQL)
    cntrec = 0
    rst.MoveFirst
    If Not (rst.EOF) Then
        While (Not (rst.EOF))
            cntrec = cntrec + 1
            rst.MoveNext
        Wend
    End If
    sam0501 = "Total record of CATALOG = " & cntrec
    rst.Close
    dbs.Close
End Function
 Function sam0502()
    Dim dbs As Database
    Dim rst As Recordset
    Dim strSQL As String
    Set dbs = CurrentDb()
    strSQL = "SELECT * FROM [catalog];"
    Set rst = dbs.OpenRecordset(strSQL)
    While (Not (rst.EOF))
        sam0502 = sam0502 & rst!catname & " - "
        rst.MoveNext
    Wend
    rst.Close
    dbs.Close
End Function
 Function sam0503()
    Dim dbs As Database
    Dim rst As Recordset
    Dim strSQL As String
    Dim keeprec As String
    Dim i As Integer
    Set dbs = CurrentDb()
    strSQL = "SELECT * FROM [catalog];"
    Set rst = dbs.OpenRecordset(strSQL)
    rst.MoveFirst
    i = 0
    If Not (rst.EOF) Then
        While (Not (rst.EOF))
            i = i + 1
            keeprec = keeprec & i & ". " & rst!catname & Chr(13) & Chr(10)
            rst.MoveNext
        Wend
    End If
    sam0503 = keeprec
    rst.Close
    dbs.Close
End Function
 Function sam0504()
    Dim dbs As Database
    Dim rst As Recordset
    Dim strSQL As String
    Set dbs = CurrentDb()
    strSQL = "SELECT * FROM [tmp];"
    Set rst = dbs.OpenRecordset(strSQL)
    While (Not (rst.EOF))
        sam0504 = sam0504 + 1
        rst.MoveNext
    Wend
    rst.Close
    dbs.Close
End Function
 |