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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Record Count using Pass Through queries

Status
Not open for further replies.

aperez54

Technical User
Aug 12, 2008
77
CA
Is there a way to get the record count using pass through query? I am getting data from Sybase, creating a temp pass through query then using that query to insert the records into my local access table.

Will I need to re-query the temp pass through query to get the count or is there a way to do it during the creation of the querydef?

Thanks
 
The only way I know how to do it is to do the insert thru ADO to get a record count, even that is questionable because not all providers support the recordcount property. Here's an example:

set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open blah blah
set rs=new adodb.recordset

sql="SELECT * FROM Customers"
rs.Open sql,conn

if rs.Supports(adApproxPosition)=true then
i=rs.RecordCount
Msgbox "The number of records is: " & i
end if

rs.Close
conn.Close

Also, if you code it as a loop you can set up your own counter to increment as you loop thru the records.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top