Solved

Open form and position to a record on subform

Posted on 2011-02-21
3
925 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
  • 2
3 Comments
 
LVL 84

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 84
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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
sql statement - 9 27
SQL multicriteria from ONE textbox 32 44
Access Delete Query Not Working 13 33
Visible ppty on rpt 7 7
This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

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