Solved

Open form and position to a record on subform

Posted on 2011-02-21
3
931 Views
Last Modified: 2012-05-11
I am using Access 2003 and I would like to open a form containing a subform with the cursor positioned on a specific record in the subform.  The subform contains a column for "ItemNumber" and I would like to specify using VBA code what Item Number in the subform that the cursor will be positioned on.  Is there a way to do this?
0
Comment
Question by:dsoderstrom
[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
  • 2
3 Comments
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 34942851
You need to use the bookmark method. If you know the ItemNumber:

Dim rst As DAO.Recordset
Set rst = Me.NameOfyourSubformCONTROL.Form.Recordset

rst.FindFirst "[ItemNumber]=" & YourItemNumber

If Not rst.NoMatch Then Me.NameOfYourSubformCONTROL.Form.Bookmark = rst.Bookmark

Obviously you'll have to change the various fields/controls to match your own.


0
 
LVL 85
ID: 34942886
Sorry, forgot to note this:

Be careful with the NameOfYourSubformCONTROL syntax also. This is the name of the Subform control you've placed on your mainform, and may or may not be the same as the Form you're using as a SourceObject. To insure you're working with the correct item, click ONCE on the Subform, then examine the Properties of that item. If you find a property named "SourceObject", you've got the right item. If not, you'll have to de-focuse that item, and try again.
0
 

Author Closing Comment

by:dsoderstrom
ID: 34943775
Worked Perfectly.  Thanks
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

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.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
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…

734 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