Function addid(tablename As String) As String
Dim a, b, c
Dim i As Integer
'流水号生成
a = DMax("[id]", tablename) + 1
'Debug.Print a
b = Format(Date, "yyyymm") & 0
If IsNull(a) Then
c = b
Else
a = CStr(a)
End If
If a > b Then
c = a
Else
c = b + 1
End If
addid = c
End Function
以下是引用6831860在2006-8-31 21:34:00的发言:
Function addid(tablename As String) As String
Dim a, b, c
Dim i As Integer
'流水号生成
a = DMax("[id]", tablename) + 1
'Debug.Print a
b = Format(Date, "yyyymm") & 0
If IsNull(a) Then
c = b
Else
a = CStr(a)
End If
If a > b Then
c = a
Else
c = b + 1
End If
addid = c
End Function