Solved

MS Access 2010 - Use code behind to open another form passing the primary key to it

Posted on 2014-02-05
4
681 Views
Last Modified: 2014-02-05
I am working on a dbase that was given to me.  The dbase used macros.  I took the project list form and changed it to not allow addition, deletions, edits.  I also converted the macro to code.

With the macro and the code now a Msg Box pops up asking for a parameter value.  This happened as soon as I changed the form setting to prevent addition, deletions and edit.  

I want any changes to be performed in the project details form.  

How can I stop that msg box from opening?
Project-List-Issue.jpg
Project-List-Issue-Code-Behind.jpg
Project-List-Issue-Code-Behind-2.jpg
0
Comment
Question by:CipherIS
  • 2
4 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 39837721
Those parameter prompts often mean that a field name is incorrect or unknown.

Take a look at the design of the table or query behind the form you are opening, and make sure that the field you are trying to match is indeed [ID] and not [ProjectID] or something similar, in which case the Where Condition argument in the OpenForm statement would be:

"[ProjectID] = "  & Nz(ID,0)

Open in new window



As an aside, its easier for us to help you if you post code snippets right in your questions, rather than screenshots of code.  Actual code lets us use your code in our comments more readily.
0
 
LVL 1

Author Comment

by:CipherIS
ID: 39837731
Thank You.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39837735
that prompt appears, because there is no field named "ID" in the
Record Source of the form  "Project Details".

check and replace "ID" with the correct name of the field
0
 
LVL 61

Expert Comment

by:mbizup
ID: 39837744
Glad to help :)
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

733 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