Using Where Conditions To Open Form

Posted on 2012-08-18
Last Modified: 2012-08-18
I have a form that has an option to add a comment. Everything is fine when I am adding a new comment, but when I want to look at a note associated with a particular record in my form, I am having problems with the where condition.

As it stands, I am unable to add any extra fields to any of the tables, so the notes associated with a record have to in some other way be linked.

I know I can use the edit note command button to open the form with a certain where condition. The problem is that I continue to get an error when I try to open the form to a certain record.

I attached a copy of the Form with the relevant tables. What I would like to happen is the following

1) When a note is attached to a record on the form click the edit command.
2) When the notes form is opened, have it reference the batch form to know where to go

Attached is a copy of the form. If you select 2F125 there is a note attached to it, however, I cant seem to get to it.

Let me know if there are any other questions, thank youNotesSampleDB.accdb
Question by:jleval
    LVL 77

    Expert Comment

    The data is in a different file.  This is just the frontend.

    Author Comment

    Sorry here is the complete database
    LVL 39

    Accepted Solution

    PartNumber is text field and your code should be:

    DoCmd.OpenForm "frmNotes", , , "[PartNumber]='" & Me.PartNumber & "'"
    DoCmd.OpenForm "frmNotes", , , "[PartNumber]=" & chr(34) & Me.PartNumber & chr(34)

    Author Closing Comment

    DoCmd.OpenForm "frmNotes", , , "[PartNumber]=" & chr(34) & Me.PartNumber & chr(34)

    Worked perfectly, Thank you

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
    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…
    In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
    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 …

    746 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

    15 Experts available now in Live!

    Get 1:1 Help Now