Jump to content

Featured Replies

Posted

Hi everyone

I am developing a desktop application in Access 2010, connected to Sharepoint online. For a long time I'm turning into a problem with no fix. This problem is to assign the result of the sum of a field in a sql query to a variable, then work with it. I have been visiting various sites even with some of the solutions proposed but never have gotten me work. (I also checked a post like this but I have not gotten anything at all).

 

I describe the procedure I've created and errors out.

Private Sub ExtractSumTime()

Dim StrSql As String, rst As Dao.Recordset, SumHours As Single, Today As Date

 

Today = DateTime.Date

 

StrSql = "SELECT SUM(WorkTask.[Tiempo Dedicado]) AS Expr1 FROM WorkTask WHERE WorkTask.[Creado por] = '" & MiUsuario & "' AND WorkTask.[Fecha] = '" & Today & "'"

 

Set rst = CurrentDb.OpenRecordset(StrSql) // here i also use (StrSql, dbOpenDynaset) or dbOpenSnapshot

 

SumHours = rst("Expr1")

 

i'm tryied with dsum or dlookup and throw me the same error "3464" No data type mismatch in criteria expression

i hope some one could help cause i don't have any idea to do it works.

Thanks in advance

 

Continue reading...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...