Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / May 2008

Tip: Looking for answers? Try searching our database.

Timeout in VB

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chakey - 16 May 2008 18:40 GMT
I open a connection in an Access module.  I then want to create a recordset
and populate it from a view that I am linked to through Access.  While the
table behind the view is quite large in both fields and records, the view
limits it to the last 2 months and only the 2 fields I need for my
application.  The view also groups and sorts the data by the 2 fields so I
don't have to do that with code.

I have no problem creating the recordset from the main table, but filtering
by my date range takes forever, though it does not timeout.  Also there is no
grouping or sorting.  However, now I timeout.  I have seen in the posts that
there are ways to increase timeout durations, but don't know how to apply the
code to an already open connection when running an SQL query (within VB) to
build the recordset.  What do I do?
Thanks for your time.
Ralph - 16 May 2008 19:21 GMT
Assuming you are using adodb?

dim myConn as adodb.connection
set myConn=new adodb.connection
myConn.CursorLocation=adUseServer
myConn.CommandTimeout=0

> I open a connection in an Access module.  I then want to create a recordset
> and populate it from a view that I am linked to through Access.  While the
[quoted text clipped - 10 lines]
> build the recordset.  What do I do?
> Thanks for your time.
Chakey - 16 May 2008 19:49 GMT
I still get the timeout error.
Here is my code(I just added the CursorLocation and CommandTimeout lines you
suggested - to no avail):

Dim cnn As New ADODB.Connection
   Dim strEmpDays As String
   Dim strHoliday As String
   Dim strcnn As String
   Dim StartDate As Date
   Dim EndDate As Date
   
   cnn.CursorLocation = adUseServer
   cnn.CommandTimeout = 0

   StartDate = DLookup("[StartDate]", "BeginDate_t")
   EndDate = DateAdd("d", 13, StartDate)
   
   strcnn = "Data Source='Global_MWP';User ID='Master';Password='master';"
   cnn.Open strcnn
   strEmpDays = "SELECT * FROM VM_TIME_ATND_HST_2M;"
   rstEmpDays.Open strEmpDays, strcnn, adOpenStatic, adLockReadOnly
  (Here is where I get the timeout error)

> Assuming you are using adodb?
>
[quoted text clipped - 17 lines]
> > build the recordset.  What do I do?
> > Thanks for your time.
Ralph - 16 May 2008 20:01 GMT
Try
cnn.ConnectionTimout=0

> I still get the timeout error.
> Here is my code(I just added the CursorLocation and CommandTimeout lines you
[quoted text clipped - 40 lines]
> > > build the recordset.  What do I do?
> > > Thanks for your time.
Chakey - 19 May 2008 13:10 GMT
I am still having trouble even after switching to cnn.ConnectionTimeout = 0.  
I get this message when performing the query in the code I mentioned in my
last post:
"Run-time error '-2147217871 (80040e31)':
[Pervasive][ODBC Client Interface][LNA][Pervasive}{ODBC Engine
Interface]S1T00Timeout expired."

Pervasive is our database engine.
I am stumped.

> Try
> cnn.ConnectionTimout=0
[quoted text clipped - 43 lines]
> > > > build the recordset.  What do I do?
> > > > Thanks for your time.
Ralph - 21 May 2008 17:01 GMT
Try this link:
http://www.tek-tips.com/viewthread.cfm?qid=1077071&page=1

> I am still having trouble even after switching to cnn.ConnectionTimeout = 0.  
> I get this message when performing the query in the code I mentioned in my
[quoted text clipped - 53 lines]
> > > > > build the recordset.  What do I do?
> > > > > Thanks for your time.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.