The problem isn't when I read it in DAO. It's when I read it in ADO. 

Bryant

--- In [email protected], [EMAIL PROTECTED] wrote:
> You need to enumerate you recordset in DAO in order for it to read
in the first record try adding this just before testing for EOF:
> 
> rst.movelast
> rst.movefirst 
> 
> 
> 
> -------------- Original message -------------- 
> 
> > I get two different results when querying the same data, depending on 
> > whether I use DAO 3.6 or ADO 2.1 recordset ... any ideas where I'm 
> > going astray? 
> > 
> > The ADO recordset retrieves zero rows each time. The SQL string is 
> > valid, since results are produced via DAO. 
> > 
> > Thanks in advance! 
> > 
> > -- Begin ADO -- 
> > Dim rst As New ADODB.Recordset 
> > Dim cnn As New ADODB.Connection 
> > Dim strSQL As String 
> > 
> > Set cnn = CurrentProject.Connection 
> > 
> > strSQL = "SELECT LateFeesCharged FROM 
> > qselTransactions_LateFeesCharged " _ 
> > & "WHERE CompanyID ='" & strCompanyID & "' " _ 
> > & "AND TenantID ='" & strTenantID & "'" 
> > 
> > rst.Open strSQL, cnn, adOpenStatic, adLockReadOnly 
> > 
> > If Not rst.EOF Then 
> > GetLateFeesCharged = rst!LateFeesCharged 
> > Else 
> > GetLateFeesCharged = 0 
> > End If 
> > 
> > rst.Close 
> > -- End ADO -- 
> > 
> > -- Begin DAO -- 
> > Dim rst As DAO.Recordset 
> > Dim strSQL As String 
> > 
> > strSQL = "SELECT LateFeesCharged FROM 
> > qselTransactions_LateFeesCharged " _ 
> > & "WHERE CompanyID ='" & strCompanyID & "' " _ 
> > & "AND TenantID ='" & strTenantID & "'" 
> > 
> > Set rst = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset, dbReadOnly) 
> > 
> > If Not rst.EOF Then 
> > GetLateFeesCharged_DAO = rst!LateFeesCharged 
> > Else 
> > GetLateFeesCharged_DAO = 0 
> > End If 
> > 
> > rst.Close 
> > 
> > -- End DAO -- 
> > 
> > 
> > 
> > 
> > 
> > Yahoo! Groups Links 
> > 
> > 
> > 
> > 
> > 
> > 
> 
> [Non-text portions of this message have been removed]





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AccessVBACentral/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to