ado recordset field becoming NULL
Hi all,
I've never come across this one before and am hoping someone may be
able to shed some light on a very strange situation.
I'm using a DNS less connection and a ADO recordset to retrieve
records from a networked database. The connection and query all works
fine, but the particular field I'm interested in suddenly becomes NULL
after a couple of seconds or after I've referenced it once. I've got
some test code below which produces the same results. Can anyone see
what's going on?
The two debug statements return this result each time (second one
becomes NULL for no reason) -
Check 1 200403061037112 * L060404000015398.hdm
Check 2 200403061037112 *
TIA,
Brad
Dim path As String, i As Integer, dest As String, files As Recordset,
db As Database, rdt As New ADODB.Recordset
Dim sql As String, mycn As New ADODB.Connection, stConn As String,
notfound() As String
ReDim Preserve notfound(0)
'set local database
Set db = CurrentDb()
Set files = db.OpenRecordset("tbl_multex_pdf_locations",
dbOpenDynaset)
'set network query
stConn = "Driver={SQL Server}; Server=ip here; Database=ResearchNet;
Uid=loginhere; Pwd=passwordhere"
mycn.Open stConn
sql = "SELECT document_table.doc_id AS Doc_id,
network_doc_table.nd_fileroots FROM document_table INNER JOIN
network_doc_table ON document_table.doc_id =
network_doc_table.nd_doc_id " _
& "WHERE (((document_table.doc_id) In (SELECT document_table.doc_id "
_
& "FROM (document_table INNER JOIN doc_pub_product_table ON
document_table.doc_id = doc_pub_product_table.doc_pub_product_doc_id)
INNER JOIN pub_product_table ON
doc_pub_product_table.doc_pub_product_pub_product_ id =
pub_product_table.pub_product_id " _
& "WHERE (((document_table.doc_date) Between '1-Apr-04' And
'1-May-04') AND ((RTrim([pub_product_name]))='Asia Ex Japan' Or
(RTrim([pub_product_name]))='Japan')))) AND
((document_table.doc_publish_flag)=1) AND
((network_doc_table.nd_network_id)='10000000000000 02'))"
'Debug.Print sql
mycn.CommandTimeout = 120
Set rdt = mycn.Execute(sql)
rdt.MoveFirst
Debug.Print "Check 1 " & rdt(0) & " * " & rdt(1)
Debug.Print "Check 2 " & rdt(0) & " * " & rdt(1) |