Solved

Open Access Form with particular record displayed

Posted on 2014-02-26
2
905 Views
Last Modified: 2014-02-26
I have an Access 2007 form that is opened (by default) on a new record.  The code in the "On Load" event for the form is as follows:

    DoCmd.GoToRecord acDataForm, Me.Name, acNewRec

What I would like to do is open the form, optionally, at a particular record.  I cannot use the "gotorecord" method, because, as I read things, a value specified (instead of the acNewRec  parameter), is an offset.  I want to be able to go to a record based on a primary key value in a table used to populate the form.

Thanks for your help.

Tom
0
Comment
Question by:tpigielski
[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
2 Comments
 
LVL 28

Accepted Solution

by:
omgang earned 500 total points
ID: 39889136
Pass a Where expression with the OpenForm command to open the form to the specified record.

DoCmd.OpenForm FormName, , , "PKValue = " & ThePKValue

OM Gang
0
 
LVL 28

Expert Comment

by:omgang
ID: 39889154
See VBA Help for OpenForm Method of DoCmd command.

expression.OpenForm(FormName, View, FilterName, WhereCondition, DataMode, WindowMode, OpenArgs)

OM Gang
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

623 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