Kathie,
The same construct can be used regardless. You'd then need to use either a
recordset or a DLookup. For example:
Dim iDay As Integer
iDay = Day(Nz(DLookup("[myDate]", "tblMyTable", strCriteria)), 0)
If iDay = 0 Then
MsgBox "Date not found"
ElseIf iDay > 20 Then
MsgBox "Greater than 20th"
Else
MsgBox "Equal to or less than 20th"
End If
....or...
Dim rs As DAO.Recordset
Dim sSQL As String
Dim iDay As Integer
sSQL = "SELECT myDate FROM tblMyTable WHERE x = 123"
Set rs = CurrentDb.OpenRecordset(sSQL, dbOpenSnapshot)
If rs.AbsolutePosition > -1 Then
iDay = Nz(rs!myDate, 0)
End If
If iDay = 0 Then
MsgBox "Date not found"
ElseIf iDay > 20 Then
MsgBox "Greater than 20th"
Else
MsgBox "Equal to or less than 20th"
End If
Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
(Currently in Japan)
---------------------------
Kathie G via AccessMonster.com said:
Thanks Graham - that worked.

What if I wanted to base the criteria off
of
a field within a table. IE: If the paydate of current month > 20th day
exists then ..process, if not, msg....
Kath,
I assume you mean you want the code in the button's Click event.
If Day(Date) > 20 Then
MsgBox "Greater than 20th"
Else
MsgBox "Equal to or less than 20th"
End If
Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
(Currently in Japan)
---------------------------
Hello all,
How would I go about putting an if statement in place to state:
[quoted text clipped - 6 lines]