DAO-Recordset 
Author Message
 DAO-Recordset

Quote:
>I make a global variable at the top of the page of code:

dim ws as workspace
dim db as database
dim rs_Q as recordset
Quote:
>Then in the Form_load() Sub I assign it

set ws=createworkspace("mainworkspace","admin","")
set db=ws.opendatabase("C:\db.mdb")
set rs_Q=db.openrecordset("data")
Quote:
>When I try to access the rs_Q for inserting
>data, It works fine.
>When I try to read a record it works fine
>But when I try to do a search.
>The Nomatch property Is always set as false.
>Even if there are no records in the recordset?

rs_Q.FindFirst ("address='" & addr & "'")
if rs_Q.NoMatch then
....
....
end if

Thanks Anyone who can help
Clint



Tue, 29 Jan 2002 03:00:00 GMT  
 DAO-Recordset
Try these "tidy-up" things...
1) the OpenRecordset should carry the optional dbOpenTable, dbOpenSnapshot
or dbOpenDynaset parameter.  For FINDFIRST to work, it needs to be opened
Snapshot or Dynaset.  By leaving this value off the parameters, the default
is TABLE -- which should not work (as you described).

2) Test the rs_Q recordcount by this...
    if not (rs_Q.BOF and rs_Q.EOF) then
        rs_Q.MoveLast
        rs_Q.MoveLast
        lRet = rs_Q.RecordCount        <This ensures proper record count.
    else
        lRet = 0
    end if
3) also, read FindFirst Documentation.

Quote:

>>I make a global variable at the top of the page of code:
>dim ws as workspace
>dim db as database
>dim rs_Q as recordset
>>Then in the Form_load() Sub I assign it
>set ws=createworkspace("mainworkspace","admin","")
>set db=ws.opendatabase("C:\db.mdb")
>set rs_Q=db.openrecordset("data")
>>When I try to access the rs_Q for inserting
>>data, It works fine.
>>When I try to read a record it works fine
>>But when I try to do a search.
>>The Nomatch property Is always set as false.
>>Even if there are no records in the recordset?
>rs_Q.FindFirst ("address='" & addr & "'")
>if rs_Q.NoMatch then
>....
>....
>end if

>Thanks Anyone who can help
>Clint



Tue, 29 Jan 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Assigning a Dao.Recordset to a Datacontrol With VB6 SP4 and Dao.360

2. DAO Recordset.LastUpdated in DAO

3. DAO recordset copying

4. cannot get the Date value from DAO recordset

5. DAO Recordset Temporaly storing

6. Object Variable in DAO Recordset

7. Operation Not supported DAO Recordset

8. please help - finding in dao recordset

9. Setting the source of a DAO.Recordset

10. Displaying DAO Recordset contents

11. DAO.Recordset.Fields property?

12. DAO Recordset as a datasource for access rpt

 

 
Powered by phpBB® Forum Software