Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Query Problem Runtime Error 94

Author  Topic 

ragh
Starting Member

34 Posts

Posted - 2005-02-10 : 23:57:44
Hi
I have a table comprising of fields like:
SLNo(int) ID name date(datetime) timein(datetime) timeout(datetime) TWH(int) Duration(char)
values are:
ID Name Date TimeIn TimeOut TWH Duration
0005 Ragh 2005-01-31 15:32:00 15:36:00 240
0005 Ragh 2005-01-31 15:38:00 15:39:00 60
0005 Ragh 2005-01-31 15:40:00 16:01:00 1260
0005 Ragh 2005-02-01 15:40:00 16:01:00 1260

----
Well, i can write this query in SQL Server like this and store Sum value in duration by convrting it into Hour and minutes.
SELECT * FROM grtable ORDER BY id, date COMPUTE SUM(twh)BY id, date

I want to have similar in MS Access, when i try it doesnt work.
I tried this query, and it show Invaid Use Of NULL runtime error 94 in VB.
SELECT SUM(TWH)FROM grTable WHERE ID = " & "'" & id & "'" & " AND [Date] = " & varDate

Why ? and how can i achieve it in access something i can do in SQL Server.
-----
Task:
Just want to calculate total Hours and minutes for particular id on that particular day and store it under duration column.
---
can someone help me pls...
regards

Ragh

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-02-11 : 00:25:47

Try this

Set Rs=Con.Execute("SELECT SUM(TWH)FROM grTable WHERE ID = '" & id & "' AND [Date] = #" & varDate & "#")

Madhivanan
Go to Top of Page

ragh
Starting Member

34 Posts

Posted - 2005-02-11 : 00:32:33
madhivanan, nandri :) its working thank you

Ragh
Go to Top of Page
   

- Advertisement -