Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Wrong recordcount? Had this problem before....

Status
Not open for further replies.

nickjar2

Programmer
Jun 20, 2001
778
US
sSQL = "SELECT tblStartFinish.Status FROM tblStartFinish WHERE (((tblStartFinish.StaffID)=" & rstCCS(15) & ") AND "
sSQL = sSQL & "((tblStartFinish.Date) Between " & ConvertDate(dteDate2) & " And " & ConvertDate(dteDate1) & " AND "
sSQL = sSQL & "((tblStartFinish.Status)='nd' Or (tblStartFinish.Status)='nn' Or (tblStartFinish.Status)='bl' "
sSQL = sSQL & "Or (tblStartFinish.Status)='cl' Or (tblStartFinish.Status)='pl')));"

Set rstISU = dbCCS.OpenRecordset(sSQL)
rstISU.MoveLast
rstISU.MoveFirst
iRecordCount = rstISU.RecordCount

I am constantly getting the wrong recordcount. When 4 recs are getting returned, iRecordCount is showing 3.
Also, before the MoveLast and MoveFirst are getting executed, the rstISU.recordcount is showing 260 for the first time, second time 330, but then when the the recordset gets populated (ie movelast and movefirst), the iRecordCont always shows one less than there should be (ie i copy the sql, and paste it into the sql window, thats how i know there is 1 record than there should be)

Very strange,

Cheers

Nick

Nick (Everton Rool OK!)
 
I suspect, that this has something to do with the open args of your recordset. or in other words: you are editing a new record at some point when you call your function ...
can you try a me.refresh on your form, before calling the func?

just guessing,
fly

Martin Serra Jr.
 
Cheers for responding

I will give that a go tomorrow at work, although I am not actuall editing at the time of executing the code

Cheers

Nick (Everton Rool OK!)
 
looking forward to the outcome of your go tomorrow (as it's really strange to me too, that the direct execution of the SQL from the SQL pane gives another result than the execution via code...)

have a nice sunday,
fly

Martin Serra Jr.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top