Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6645393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:16:54+00:00 2026-05-26T00:16:54+00:00

I can not get the OpenForm method to open a form with the correct

  • 0

I can not get the OpenForm method to open a form with the correct record loaded. I’m going to do my best here to provide the details:

The ‘source’ form is based off Table A, and it is read-only. A button on the source form is being used to open a ‘target’ form that is used for editing records, also from Table A.

I have tried using the wizard to create the button that opens the form based on primary key equality. The result from the wizard is that no matter what record is in context on the source form, only the first record in Table A is ever loaded by the target form.

I have tried using a procedure with the following variations:

Dim frm As String, whr As String
frm = "Target Form"
whr = "Forms![Source Form]!ID = Forms![Target Form]!ID"
'whr = "[ID] = [ID]"
'whr = "[ID] = Forms![Target Form]!ID"
DoCmd.OpenForm frm, acNormal, , whr, , , 1

I could either get only the first record to load in the target form or get a new record to load in the target form. But I can not get the source form’s loaded record to determine the record loaded into the target form.

Thanks for any help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T00:16:55+00:00Added an answer on May 26, 2026 at 12:16 am

    I think you got close. You want the WhereCondition to be the same as a WHERE clause for a query of Target Form’s record source, but without the word WHERE.

    Dim frm As String, whr As String
    frm = "Target Form"
    whr = "[ID] = " & Me.ID
    Debug.Print "whr: " & whr
    DoCmd.OpenForm frm, acNormal, , whr
    

    I intended Me.ID as the value of a control whose name is ID and is bound to a field in the current record of Source Form. Me is shorthand for “this form”. One reason it’s useful is because you wouldn’t have to revise your code if you later decide to give the form a different name.

    I added the Debug.Print statement so you can switch to the Immediate Window (Ctrl+g), and copy the whr string, then paste it into a new query based on the same record source which Target Form uses. That could be helpful in case you still don’t get the correct record displayed when Target Form opens.

    Your version also included 1 as OpenArgs to OpenForm. I didn’t see how you were using that, so left it off. If Target Form includes an event procedure which does something with OpenArgs, make sure it doesn’t override your WhereCondition.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can not get the ContextMenuResource to return the correct information that I am
I simply can not get Visual Studio 2005 to find the System.Configuration.ConfigurationManager class. Here
I can not get back my data, here is my code. where is the
now I can not get the correct information List<HeaderHelper> h = pr.Actual_View(); foreach (TemplateHeader
I want to write Html format, but I can not even get a simple
I can get the element like this $(#txtEmail) but I'm not sure how to
I can't seem to get it to work. Perhaps I'm not even testing it
So Google Analytics does not have an API that we can use to get
I get errors when viewing forms and there are not any. I can close
I can not get the difference between these sentences! would you please write some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.