Solved

GoTo record using listbox on subform

Posted on 2013-12-30
2
574 Views
Last Modified: 2013-12-30
I have a form that has a main form and then a subform.  The subform is linked to a different table than the main form.  I am trying to go to the record clicked on the subform.  So example
I click an item in the listbox from the subform and the subform goes to that item number.  I have tried:

'find the first value that matches
Me.[frmsubworkorder].[Form].RecordsetClone.FindFirst _
"[item] = " & [frmsubworkorder].[Form]![List4]

'if a matching record was found, then move to it
If Not [frmsubworkorder].[Form].RecordsetClone.NoMatch Then
[frmsubworkorder].[Form].formBookmark _
= [frmsubworkorder].[Form].Form.RecordsetClone.Bookmark
End If

When I try this I get the following runtime error:
Run-time error '2465':
Microsoft Office Access can't find the fild '|' referred to in you expression.

I have checked and list4 is showing the correct item number.

Any help would be greatly appreciated!!  Thanks in advance!
0
Comment
Question by:russell12
2 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 39747332
try this using the afterupdate event of [List4], or using a click event of a button in the subform


private sub list4_afterupdate()

with me.recordsetclone
       .FindFirst  "[item] = " & me.List4
      if not .nomatch then
       me.bookmark=.bookmark
       else
        msgbox "Record not found"
        exit sub
      end if
end with

end sub



Note: if [item] field is Text data type use
       .FindFirst  "[item] = '" & me.List4 & "'"
0
 
LVL 2

Author Closing Comment

by:russell12
ID: 39747338
ARE YOU SERIOUS!!! I have been working on this issue for about 1 month and I was going to try experts exchange for one last resort before just making another form to view the record from the subform.  You are a life saver!!!!  Thank you!!!!!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

746 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

12 Experts available now in Live!

Get 1:1 Help Now