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 2006

Tip: Looking for answers? Try searching our database.

not a valid bookmark

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
peljo - 28 May 2006 17:55 GMT
I have a function that finds a customer.When the customer does not exist, i
get the error not a valid bookmark.
Can you help me with my function ? Is there something wrong with it ? Can i
improve it and make it more stable ?

Public Function FindCustomer()
Dim f As Form
Set f = Forms!FCustomers
Dim strCustomerID As String
Dim strBookmark As String
strCustomerID = InputBox("Enter customer number  ? ")
If strCustomerID = "" Then
Exit Function
End If
f.RecordsetClone.FindFirst "CustomerID = " & strCustomerID
If f.RecordsetClone.NoMatch Then
MsgBox "customer " & strCustomerID & " does not exist!!"
f.Bookmark = strBookmark
Else
f.Bookmark = f.RecordsetClone.Bookmark
End If

End Function
Dirk Goldgar - 28 May 2006 18:21 GMT
> I have a function that finds a customer.When the customer does not
> exist, i get the error not a valid bookmark.
[quoted text clipped - 19 lines]
>
> End Function

This line is the source of the problem:

> f.Bookmark = strBookmark

It serves no purpose anyway, and should just be deleted.

You'd do well to rewrite the last bit slightly, to access the
RecordsetClone property only once, like this:

   With f.RecordsetClone
       .FindFirst "CustomerID = " & strCustomerID
       If .NoMatch Then
           MsgBox "customer " & strCustomerID & " does not exist!!"
       Else
           f.Bookmark = .Bookmark
       End If
   End With

Signature

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

 
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.