Showing posts with label value. Show all posts
Showing posts with label value. Show all posts

Wednesday, March 7, 2012

Recordset Counts

I am trying to count the number of records in a recordset I have created. It always returns a value of -1 nomatter how many records are actually there. I have other operations working fine using similar code, but this one will not work correctly. Can anyone help. Here is the code.

Set ashcontentcountcmd = New ADODB.Command
ashcontentcountcmd.ActiveConnection = ashconn
Set ashcontentcountrs = New ADODB.Recordset
ashcontentcountrs.ActiveConnection = ashconn

ashsource = lstash.List(lstash.ListIndex)

ashcontentcount = "select ID from Flyash where Source ='" + ashsource + "'"

ashcontentcountcmd.CommandText = ashcontentcount ashcontentcountrs.Open ashcontentcountcmd

Debug.Print ashcontentcountrs.RecordCount

Thank you in advance for any help.

MichaelYou need to make it a client-side cursor to return the recordcount or your cursor is the wrong type.|||I am new to this stuff. I don't know what you mean by a client-side cursor. This is an Access database I am connecting to.

Monday, February 20, 2012

Record value depending of the next record

Hi,
I am trying to do something with Crystal Reports 9, but I am not sure if it is possible to do it...

how_long is the field I want to add
...depending of how many consecutive True value there is in the active field, I want to know for how many days it is True

when it is False...I put no value in the how_long record

SEE example.txt

I thought I could use the function Next(), but I need to go further than the next record

Any way to do this?
Would it be with a subreport? I don't know
Thanks for your help

Michaelput a formula which gives 1 when active is true then use running total and reset it when value changes , hope it workss..