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

Using .Seek with an ADO recordset. 3

Status
Not open for further replies.

Phooey

Programmer
Feb 14, 2000
111
GB
I have found a problem using the .Seek method with an ADO recordset and cannot understand why it happens.&nbsp;&nbsp;The .Seek method works well in itself (until the database is split, but I know why that happens now.) until used.&nbsp;&nbsp;In certain circumstances, when the .Seek method is used, another instance of MSAccess appears to start running as a TSR when the database is exited.&nbsp;&nbsp;While the MSAccess is running in the background (there are no windows or another hint as to its existence), Access will not work properly.<br><br>The only way I have found to kill the ghost instance of Access is to pick it out from Ctrl-Alt-Del and end the task.<br><br>Has anyone else found this error, or know of a way around it.?
 
So stop using Seek and use SQL instead<br>Instead of this:<br>Dim MyDB As Database, rst As Recordset<br>&nbsp;&nbsp;&nbsp;&nbsp;Set MyDB = OpenDatabase(&quot;\\SLMD\SYS\ACCESS\LEADTIME.MDB&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;Set rst= MyDB.OpenRecordset(&quot;LEADTIME&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rst.Index = &quot;PrimaryKey&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rst.Seek &quot;=&quot;, Me![Project].text<br>-----------------------<br>Use this:<br>Dim MyDB As Database, rst As Recordset ,SQL as String<br>&nbsp;&nbsp;&nbsp;&nbsp;Set MyDB = currentdb<br>SQL = &quot;Select * From [LEADTIME] Where [YourPrimaryKeyField] = &quot; & Me![Project].text<br>Set rst = MyDB.OpenRecordset(SQL)<br><br>so you refer to the fields the same way<br>like:<br>rst!yourfield = somevalue<br>of <br>somevalue = rst!yourfield <br><br>OK this is much faster than .SEEK<br>Plus you can create complicated multi-table queries in the Access QBE grid and paste the SQL code it creates in the above SQL statement.<br><br> <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top