Solved

Error 2115 finding record

Posted on 2007-04-10
3
295 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

831 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