• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 584
  • Last Modified:

Double-clicking on a particular record to open up that record in a different form

I have been racking my brain over and over this code to allow an user to double-click on a particular record on my main dashboard screen to open up another form and go to that particular record that I double-clicked on.

The primary key has been set and I would want it to find that record in the other form based on the primary key.  I can get the double-click to open up the form but it will not go to the particular record.  

So my question is how can I put together code to all me to do that?
0
lauriecking0623
Asked:
lauriecking0623
  • 3
  • 2
3 Solutions
 
mbizupCommented:
You would use a WHERE condition in your OpenForm statement:

DoCmd.OpenForm "YourOtherForm", WhereCondition := "YourIDField = " & Me.ID

Open in new window

0
 
lauriecking0623Author Commented:
@mbizup

When I put in the code into my application and double-click on a record in my datasheet, it gives me a window "Enter Parameter Value".

I put the code as DoCmd.OpenForm "CASES", WhereCondition :="Case_Number =" & Me.Case_Number.

My case number is "LL-00001" format with two letters, hyphen and five digits. I am wondering if I have to doing something more with the string.

Did I put that in correctly?
0
 
mbizupCommented:
If casenumber is Text, use this syntax instead:

DoCmd.OpenForm "CASES", WhereCondition :="Case_Number ='" & Me.Case_Number & "'"

Open in new window

My previous post assumed it was numeric.

If you are getting a parameter prompt, you also need to verify that you have a field named "Case_Number" in your CASES form's recorsource table or query.
0
 
mbizupCommented:
In other words, check that the field exists in the recordsource of form CASES exactly as you have written it.  A common mistake is to use underscores to replace spaces in field names.  If your field name contains a space, you would have to use this syntax with square brackets:


DoCmd.OpenForm "CASES", WhereCondition :="[Case Number] ='" & Me.Case_Number & "'"

Open in new window

0
 
lauriecking0623Author Commented:
This worked perfectly now. THANK YOU so much!!!!!!!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now