PC Review


Reply
Thread Tools Rate Thread

bookmark - runtime error "3420"

 
 
Sangster
Guest
Posts: n/a
 
      6th Aug 2008
Me.Form.Bookmark = rst.Bookmark runs OK most of the time. But it has runtime
error 3420 from time to time. I pasted below the subroutine that causes this
problem. I would really appreciate if someone can shed light on this
mysterious problem.

Thanks,

Sang

Private Sub Customer_AfterUpdate()
Dim strCustomer As String
Dim dbBible As DAO.Database
Dim rst As DAO.Recordset
Dim strCriteria As String
Dim CustomerID As Integer

If Not IsNothing(Me.Customer) Then
strCustomer = Me.Customer
CustomerID = DLookup("Customer_ID", "tblCustomers", "Customer = '" &
strCustomer & "'")
strCriteria = "Customer_ID=" & CustomerID
Set dbBible = CurrentDb
Set rst = dbBible.OpenRecordset("tblCustomers", dbOpenDynaset)
rst.FindFirst strCriteria
If rst.NoMatch Then
MsgBox "No entry found.", vbInformation
Else
Me.Customer = rst!Customer
Me.Form.Bookmark = rst.Bookmark
End If
If TempVars!frmWorkOrdersOpen = 1 Then
Forms!frmWorkOrders.Company = rst!Customer
Forms!frmWorkOrders.Contact = rst!Contact
Forms!frmWorkOrders.Street = rst!Street
Forms!frmWorkOrders.City = rst!City
Forms!frmWorkOrders.State = rst!State
Forms!frmWorkOrders.Zip_Code = rst!Zip_Code
Forms!frmWorkOrders.Phone = rst!Phone
Forms!frmWorkOrders.Refresh
End If
rst.Close
Set rst = Nothing
dbBible.Close
Set dbBible = Nothing
End If
End Sub

 
Reply With Quote
 
 
 
 
Stefan Hoffmann
Guest
Posts: n/a
 
      6th Aug 2008
hi,

Sangster wrote:
> Me.Form.Bookmark = rst.Bookmark runs OK most of the time. But it has runtime
> error 3420 from time to time. I pasted below the subroutine that causes this
> problem.

This error normally indicates that an used object became invalid.

I would try two things:

Adding an appropriate error handling with On Error Goto and

Set rst = dbBible.OpenRecordset("tblCustomers", dbOpenSnapshot)


mfG
--> stefan <--

 
Reply With Quote
 
John Spencer
Guest
Posts: n/a
 
      6th Aug 2008
The problem is that the bookmarks for the two recordsets aren't necessarily
the same. The order of the records may be different, the number of records
may be different, etc.

Why don't you use the form's RecordSetClone?
Set rst = Me.RecordsetClone

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County

Sangster wrote:
> Me.Form.Bookmark = rst.Bookmark runs OK most of the time. But it has runtime
> error 3420 from time to time. I pasted below the subroutine that causes this
> problem. I would really appreciate if someone can shed light on this
> mysterious problem.
>
> Thanks,
>
> Sang
>
> Private Sub Customer_AfterUpdate()
> Dim strCustomer As String
> Dim dbBible As DAO.Database
> Dim rst As DAO.Recordset
> Dim strCriteria As String
> Dim CustomerID As Integer
>
> If Not IsNothing(Me.Customer) Then
> strCustomer = Me.Customer
> CustomerID = DLookup("Customer_ID", "tblCustomers", "Customer = '" &
> strCustomer & "'")
> strCriteria = "Customer_ID=" & CustomerID
> Set dbBible = CurrentDb
> Set rst = dbBible.OpenRecordset("tblCustomers", dbOpenDynaset)
> rst.FindFirst strCriteria
> If rst.NoMatch Then
> MsgBox "No entry found.", vbInformation
> Else
> Me.Customer = rst!Customer
> Me.Form.Bookmark = rst.Bookmark
> End If
> If TempVars!frmWorkOrdersOpen = 1 Then
> Forms!frmWorkOrders.Company = rst!Customer
> Forms!frmWorkOrders.Contact = rst!Contact
> Forms!frmWorkOrders.Street = rst!Street
> Forms!frmWorkOrders.City = rst!City
> Forms!frmWorkOrders.State = rst!State
> Forms!frmWorkOrders.Zip_Code = rst!Zip_Code
> Forms!frmWorkOrders.Phone = rst!Phone
> Forms!frmWorkOrders.Refresh
> End If
> rst.Close
> Set rst = Nothing
> dbBible.Close
> Set dbBible = Nothing
> End If
> End Sub
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"Error! Not a valid bookmark in entry on page" in my index Tom Adams Microsoft Word New Users 1 4th Sep 2010 06:46 PM
My noteref to valid bookmark says "Error! Bookmark not defined."? =?Utf-8?B?amNoaWxkZXJzXzk4?= Microsoft Word Document Management 3 5th Oct 2006 02:23 PM
Outlook 2003 error "The Name Could Not Be Resolved. Bookmark invalid" grund1712 Microsoft Outlook 0 6th Sep 2005 10:38 AM
Delete rows created when Error 3159 "Not a valid bookmark" encount =?Utf-8?B?SXJpbmUgRi4=?= Microsoft Access Forms 3 21st Jul 2005 07:46 AM
O2k3 exch03-setup error "The Name could not be resolved. The bookmark is not valid" Oz Microsoft Outlook Installation 2 8th Feb 2005 12:13 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:25 AM.