I have a table with a time in a datetime field on an MSSQL2k8R2 server. I have linked the table in Access 2007. The table was migrated with the migration assistant from Microsoft.
i.e. the Managemantstudio will give on SELECT TOP 3 [AbZeit], [AbBrP] FROM [dbo].[tSollFahrten] the Result
AbZeit AbBrP
1899-12-30 12:53:00.000 LOR
1899-12-30 09:27:00.000 BAT
1899-12-30 10:54:00.000 LOR
When I am going to open an ADO recordset and set a filter, it worked fine (but slow).
Dim rs As New ADODB.Recordset
rs.Open "Select * from tSollFahrten;", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
rs.Filter = "AbZeit=#12:53#"
Debug.Print rs.RecordCount
rs.Close
The result is one recordset. But to open the recordset already filterd won’t work at all. I have no result.
Dim rs As New ADODB.Recordset
rs.Open "Select * from tSollFahrten where AbZeit = #12:53#;", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
Debug.Print rs.RecordCount
rs.Close
Has anyone an idea what’s going on there?
The problem is, that the time is in the SQL server stored as
datetime. So the field in the linked table is adatetime. When the time is stored as atime(7)in the SQL server, the field in the linked table will get atext. And then the select will work withAbZeit='12:53'as expected.