北京 | 上海 | 天津 | 重庆 | 广州 | 深圳 | 珠海 | 汕头 | 佛山 | 中山 | 东莞 | 南京 | 苏州 | 无锡 | 常州 | 南通 | 扬州 | 徐州 | 杭州 | 温州 | 宁波 | 台州 | 福州 | 厦门 | 泉州 | 龙岩 | 合肥 | 芜湖 | 成都 | 遂宁 | 长沙 | 株洲 | 湘潭 | 武汉 | 南昌 | 济南 | 青岛 | 烟台 | 潍坊 | 淄博 | 济宁 | 太原 | 郑州 | 石家庄 | 保定 | 唐山 | 西安 | 大连 | 沈阳 | 长春 | 昆明 | 兰州 | 哈尔滨 | 佳木斯 | 南宁 | 桂林 | 海口 | 贵阳 | 西宁 | 乌鲁木齐 | 包头 |
ACCESS自带的函数可以作为默认值,例如文本的默认值=date() 或 =format(date(),"yymmdd")
想问问ACCESS有什么办法可以使用自定义函数作为默认值?
例如现自定义函数getdatetime,如下:
Option Compare Database
Private Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type
Private Declare PtrSafe Sub GetLocalTime Lib "kernel32" (lpSystemTime As SYSTEMTIME)
Public Function getdatetime() As String
Dim LCT As SYSTEMTIME
Dim ymd As String, hms As String
GetLocalTime LCT
ymd = Format(LCT.wYear & "-" & LCT.wMonth & "-" & LCT.wDay, "yyyyMMdd")
hms = Format(LCT.wHour, "00") & Format(LCT.wMinute, "00") & Format(LCT.wSecond, "00") & Format(LCT.wMilliseconds, "000")
getdatetime = ymd & hms
End Function
那么,有什么办法可以用这个自定义函数getdatetime作为默认值?
请版主及各位大侠帮忙,谢谢!