B
Benno
Guest
Hi
I have a calendar on a form, when a user chooses a date from the calendar, I want to check whether the date chosen already exists within an append table that I have under the 'Date' field.
I thought the code below would do it but unfortunately not....any ideas?
Thanks in advance
Benno
Sub GenFunctions()
Dim x As Integer
Dim CountThisDate As Date
Dim dbs As Database
Dim rst As Recordset
CountThisDate = [Forms]![form1].[script_date]
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("SELECT Count(Ericsson.Date) As CountOfDate" & "FROM Ericsson WHERE Date = #" & CountThisDate & "#;")
x = rst!CountOfDate
MsgBox x
End Sub
I have a calendar on a form, when a user chooses a date from the calendar, I want to check whether the date chosen already exists within an append table that I have under the 'Date' field.
I thought the code below would do it but unfortunately not....any ideas?
Thanks in advance
Benno
Sub GenFunctions()
Dim x As Integer
Dim CountThisDate As Date
Dim dbs As Database
Dim rst As Recordset
CountThisDate = [Forms]![form1].[script_date]
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("SELECT Count(Ericsson.Date) As CountOfDate" & "FROM Ericsson WHERE Date = #" & CountThisDate & "#;")
x = rst!CountOfDate
MsgBox x
End Sub