Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Database Access / July 2007



Tip: Looking for answers? Try searching our database.

bookmark problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
James D. Houston - 16 Jul 2007 23:14 GMT
Can someone tell me why this isn't working?  I'm trying to use a bookmark to
go to a particular record in a recordset.  The recordset is from an Access
97 database.  Here's the code:

Dim sConn As String

   Set cnWebOrder = New ADODB.Connection

   If sDBPath = "" Then sDBPath = "c:\documents and settings\my
documents\web orders\weborders.mdb"

   sConn = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security
Info=False;Data Source=" & sDBPath

   With cnWebOrder
       .ConnectionString = sConn
       .CursorLocation = adUseClient
       .Open
   End With

Dim sSQL As String

sSQL = "Select * from tblweborders" & vbCrLf
sSQL = sSQL & "WHERE (((tblweborders.Name) Like " & "'%" & sCustName &
"%'));"

With rsWebOrder
       .ActiveConnection = cnWebOrder
       .CursorLocation = adUseClient
       .CursorType = adOpenStatic
       .LockType = adLockOptimistic
       .Open sSQL
   End With

With rsWebOrder
       .MoveFirst
       .MoveLast
       .MoveFirst
   End With
'The following in a double click event in a grid control:

Dim vBkMk As Variant

   rsWebOrder.MoveFirst

   vBkMk = CVar(fgBrowse.TextMatrix(fgBrowse.Row,
fgBrowse.ColIndex("Bookmark")))

  rsWebOrder.Bookmark = vBkMk

The line rsWebOrder.Bookmark = vBkMk throws the error "Run time error 3001.
Arguments are of the wrong type, are out of acceptable range, or are in
conflict with one another."

I've stepped through the code and vBkMk evaluates to a valid bookmark, so I
can't think why this isn't working.  If anyone can tell me where I'm going
wrong, I would appriciate it.  Thanks in advance

Jim
Paul Clement - 19 Jul 2007 16:10 GMT
¤ Can someone tell me why this isn't working?  I'm trying to use a bookmark to
¤ go to a particular record in a recordset.  The recordset is from an Access
¤ 97 database.  Here's the code:
¤
¤ Dim sConn As String
¤
¤     Set cnWebOrder = New ADODB.Connection
¤
¤
¤     If sDBPath = "" Then sDBPath = "c:\documents and settings\my
¤ documents\web orders\weborders.mdb"
¤
¤     sConn = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security
¤ Info=False;Data Source=" & sDBPath
¤
¤     With cnWebOrder
¤         .ConnectionString = sConn
¤         .CursorLocation = adUseClient
¤         .Open
¤     End With
¤
¤ Dim sSQL As String
¤
¤ sSQL = "Select * from tblweborders" & vbCrLf
¤ sSQL = sSQL & "WHERE (((tblweborders.Name) Like " & "'%" & sCustName &
¤ "%'));"
¤
¤ With rsWebOrder
¤         .ActiveConnection = cnWebOrder
¤         .CursorLocation = adUseClient
¤         .CursorType = adOpenStatic
¤         .LockType = adLockOptimistic
¤         .Open sSQL
¤     End With
¤
¤ With rsWebOrder
¤         .MoveFirst
¤         .MoveLast
¤         .MoveFirst
¤     End With
¤ 'The following in a double click event in a grid control:
¤
¤ Dim vBkMk As Variant
¤
¤     rsWebOrder.MoveFirst
¤
¤     vBkMk = CVar(fgBrowse.TextMatrix(fgBrowse.Row,
¤ fgBrowse.ColIndex("Bookmark")))
¤
¤    rsWebOrder.Bookmark = vBkMk
¤
¤ The line rsWebOrder.Bookmark = vBkMk throws the error "Run time error 3001.
¤ Arguments are of the wrong type, are out of acceptable range, or are in
¤ conflict with one another."
¤
¤ I've stepped through the code and vBkMk evaluates to a valid bookmark, so I
¤ can't think why this isn't working.  If anyone can tell me where I'm going
¤ wrong, I would appriciate it.  Thanks in advance

Are you sure that the Bookmark in the FlexGrid is the same as that for a Recordset?


Paul
~~~~
Microsoft MVP (Visual Basic)
 
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



©2009 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.