T
TonyT
continuing from a previous post that i thought had answered my question, but
proved to be erratic in use;
I have code in the On_Open event of a form setting the recordsource for that
form;
If lngCRefNum > 0 Then
strSQLRecSrc = "SELECT * FROM tblCont WHERE ContCRefNum = " &
lngCRefNum & ""
Me.RecordSource = strSQLRecSrc
End if
This all works fine, but, I am then trying to count the number of records
this may include before the form becomes 'active' so i can make various
changes to how it displays etc. sometimes the code;
Me.Recordset.MoveLast
Me.Recordset.MoveFirst
lngRecCount = Me.Recordset.RecordCount
returns the correct value, but mostly returns the error 'No Current Record'
as it appears to be trying to count before the code above has actually
populated the RecordSource regardless of where I put each piece of code.
Where should i be putting the recordCount code in the form's procedures? Or
should i be using different methods?
(ps for future reference, if I mark a post response as 'helpful', do the
respondents usually ignore it from then on as completed?)
proved to be erratic in use;
I have code in the On_Open event of a form setting the recordsource for that
form;
If lngCRefNum > 0 Then
strSQLRecSrc = "SELECT * FROM tblCont WHERE ContCRefNum = " &
lngCRefNum & ""
Me.RecordSource = strSQLRecSrc
End if
This all works fine, but, I am then trying to count the number of records
this may include before the form becomes 'active' so i can make various
changes to how it displays etc. sometimes the code;
Me.Recordset.MoveLast
Me.Recordset.MoveFirst
lngRecCount = Me.Recordset.RecordCount
returns the correct value, but mostly returns the error 'No Current Record'
as it appears to be trying to count before the code above has actually
populated the RecordSource regardless of where I put each piece of code.
Where should i be putting the recordCount code in the form's procedures? Or
should i be using different methods?
(ps for future reference, if I mark a post response as 'helpful', do the
respondents usually ignore it from then on as completed?)