General information
Category:
Coding, syntax & commands
Hi Craig....
You are making this harder than it needs to be. Here is some modified code:
' Declare these in the general declarations section of the form
Option Explicit
Dim conn As New adodb.connection
Dim rs As New adodb.connection
Dim connectionstring As String
Dim SQLString As String
ConnectString = "DRIVER=Microsoft Visual FoxPro Driver;" & _
"UID=;SourceType=DBC;Exclusive=No;" & _
"BackgroundFetch=Yes;Collate=Machine;" & _
"SourceDB=c:\logbook\logbook.dbc """
SQLString = "Select * from Mission"
'Open connection
conn.Open (ConnectString)
' open recordset object
With rs
.CursorType = adOpenStatic
.Source = SQLString .ActiveConnectin = conn
.LockType = adLockBatchOptimistic
.Open
EndWith
Declare the conn an rs objects in the general declarations section of the form. This will provide scope throughout the form. Also, every client-side ADO Recordset is a static cursor type. Therefore, you do not need to declare that property specifically. Also, I suggest using batch optimistic locking. You were performing a lot of extra work with creating the recordset via the execute method - only to close and reopen. This may be the issue. I can tell you that the OLE-DB Provider for ODBC does indeed support MoveLast, MoveFirst, MoveNext, MovePrevious, etc.... One thing you will need to watch out for is Numeric Types. With Client-Side cursors - you will need to make those fields Double-Precision types.
Also, VB supports strong typing. Take advantage of it by using Option Explicit and explicitly declaring each variable.
Let me know how things go...
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only