dim ssql as string
dim TheFiledName as string
dim D as Date
dim T as long
TheFiledName="当前日期"
D=Date()
T=10
ssql="Select Top " & T 'T是Top子句需要用到的变量值
ssql=ssql & " *,#" & D & "# As " & TheFiledName 'D是【当前日期】字段变量需要用到的变量值,TheFiledName确定的是字段变量名称
ssql=ssql & " From 表1"
Me.Form.RecordSource = ssql
msgbox ssql
'SQL语句以ssql字符串变量表示为:
'Select Top 10 *,#2011/7/22# as 当前日期 From 表1