Solved

Error 2115 finding record

Posted on 2007-04-10
3
298 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

630 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