Solved

Error 2115 finding record

Posted on 2007-04-10
3
293 Views
Last Modified: 2012-08-14
Hi Experts,

I have 2 listboxes, one giving a subset of the other.   I want to be able to click on the second listbox, and then show that individual record in the fields on my form.

Using:

Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[OrdersDeliveryID] = " & Str(Me![DeliveryListbox])
Me.Bookmark = rs.Bookmark

This works.

However, I'd like to set the first listbox so that if I click a record, it goes to the first record in the second listbox, and displays the data.  

So, this should work:

Private Sub BreakdownListbox_AfterUpdate()
'Me.OrdersBreakdownRef = Me.BreakdownListbox
'Me.OrdersRef = Forms!Orders!OrdersID
Me.DeliveryListbox.Requery
If Me.DeliveryListbox.ListCount = 0 Then
'if empty new record?
Else
With Me.DeliveryListbox
     .Selected(1) = True
     .Value = .ItemData(1)
End With
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[OrdersDeliveryID] = " & Str(Me![DeliveryListbox])
Me.Bookmark = rs.Bookmark
End If
End Sub

However I get an 2115 error, which I understand means the record is already being updated - I just don't know how to get round it.

Any ideas?
0
Comment
Question by:Norbert2000
3 Comments
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 18882942
try this and see if it helps:
change both occurences of the following:
          rs.FindFirst "[OrdersDeliveryID] = " & Str(Me![DeliveryListbox])
To:
         rs.FindFirst "[OrdersDeliveryID] = '" & Str(Me![DeliveryListbox]) & "'"

0
 
LVL 34

Accepted Solution

by:
jefftwilley earned 500 total points
ID: 18883108
comment this line out

 .Value = .ItemData(1)
0
 
LVL 1

Author Comment

by:Norbert2000
ID: 18883587
Jeff,

Commenting out     .Selected(1) = True worked - so thanks for a point in the right direction!
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now