Mega Code Archive

 
Categories / VisualBasic Script / Access
 

Using Date field type in select statement

Sub FindProject()     Dim strSQL As String     Dim rst As ADODB.Recordset     Set rst = New ADODB.Recordset     rst.ActiveConnection = CurrentProject.Connection     rst.CursorType = adOpenStatic     rst.Open "Select * FROM Employees WHERE BirthDate = #12/31/2007#"     'Attempt to find a specific project     strSQL = "[EmployeeID] = " & 1     rst.Find strSQL     'Determine if the specified project was found     If rst.EOF Then         msgBox lngValue & " Not Found"     Else         msgBox lngValue & " Found"     End If     rst.Close     Set rst = Nothing End Sub