我的access数据库文件中有一些代码,它是用Visual Basic编写的,我想要从下面的代码中得到的是,我想要得到#1/,而不是“#1/1/2020#”的硬编码值/12023#今年,意味着两年前的第一天,你能帮我一下吗,非常感谢。
Private Sub txt_bene_birth_date_BeforeUpdate(Cancel As Integer)
Dim s As String
If IsNull(txt_bene_birth_date) Then
s = "The beneficiary birthdate field is a required field and can not be left blank." & vbCrLf & vbCrLf & vbCrLf
InputError txt_bene_birth_date, s, "Beneficiary Birthdate"
Exit Sub
End If
If Not IsNull(txt_bene_birth_date) And (txt_bene_birth_date < #1/1/1900# Or txt_bene_birth_date > #1/1/2020#) Then
s = "The calculator does not support beneficiary birthdates prior to 1/1/1900 or subsequent to 1/1/2020. " & vbCrLf & vbCrLf & vbCrLf
InputError txt_bene_birth_date, s, "Beneficiary Birthdate"
Exit Sub
End If
End Sub
类似这样的:
txt_bene_birth_date > #01/01/ & DatePart("yyyy",Today())-2 & #