Solved

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

Posted on 2014-02-05
4
672 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
Comment Utility
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
Comment Utility
Thank You.
0
 
LVL 119

Expert Comment

by:Rey Obrero
Comment Utility
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
Comment Utility
Glad to help :)
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
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…
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…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now