then you must figure out why the query statement isn't gathering any records. put a break point after the 'openrecordset' code and hover over any variables.
are you familiar with the vba tools that are available for debugging purposes? i can recreate this error on the second occurance of the code if I DON'T change the eventtime field to a short date and leave it as a date/time combination field.
is that it I wonder?
there's really nothing else I can think of, sir.
I think your best bet now would be to have me or someone else take a look at the db you're actually trying this on. is that a possibility? what does 'crash' mean? is it stilll breaking on the same line? with the same error?
it probably wouldn't take but a couple minutes to figure out why the recordset is bringing back 0 records.
i'm using 07. which version are you using?
and yes i'm getting tired of this, but your charming wit is keeping me coming back.
I recorded a screen capture of how it works, but the file is too large to upload. but I attached two pics of what you see after running it...
ill have to get a copy of 2007 and try it, im on 2003![]()
Set rstemp = db.OpenRecordset("SELECT [State], [EventTime], [EventTicks] " & _
"FROM EVENTS " & _
"WHERE [EventTime] = #" & udays(0, i) & "#" & _
" ORDER BY [EventTicks] ASC", dbOpenDynaset)
Set rstemp = db.OpenRecordset("SELECT DISTINCT [EventTime] " & _
"FROM Events", dbOpenDynaset) 'DISTINCT RECS NEEDED
udays() = rstemp.GetRows(rstemp.RecordCount)
you'd be better off figuring out the error, cmp. there's only one issue: the
...
the udays() array. most likely, the 'udays(0, i)' criteria is not being found in the EventTime field. so break it on the above 'set' statement and hover over udays(0, i). if it is in error, it will probably say 'empty'. i
udays() = rstemp.GetRows(rstemp.RecordCount)[/code]
there is no difference about hovering vars in both versions. but note that help will issue a red-x 'critical' message and block help from opening in vba and ms access both if you don't have enough memory to open it. It's happened to me before.
I think that might also be a sign of corruption of access, but I can't say for sure.
Ok, reinstalled, help working ok now but still no data on hovering over some variables.
UBound(udays, 2) is showing as = 0
so I suppose this is the problem I need to work out why. Is there any way of seeing what a dao.dataset conatins?
SELECT DISTINCT [EventTime]
"FROM Events ORDER BY [EventTicks]
Actually, this would be pretty easy if you were using SQL Server or another db that has stored procedures along with triggers. Well, good luck. If you are ever in Dingle, raise a pint for me. I probably will not be back for a few years.
I suspect it doesn't work because Access records milliseconds along with seconds, but only displays seconds. I don't know this 100%, but I think that's right.I cannot for the life of me get this query to work even though that date/time exists in the events table. If I remove the date criteria it works. What am I missing?
SELECT Events.State, Events.EventTime, Events.EventTicks
FROM Events
WHERE (((Events.EventTime)=#11/23/2010 16:11:34#))
ORDER BY Events.EventTicks;
Chipper T,
can you tell me how you would do it using SQL server (express) with triggers and stored procedures? Presumably I could setup an ODBC link to the Access Events table?
if you are interested, attached is jpg taken tonight of bats in the IR beams. (I have remote access to webcams in the roost.)
cheers.