Solved

Error 2115 finding record

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
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 Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
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…

919 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

20 Experts available now in Live!

Get 1:1 Help Now