Link to open a record in a Form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • GLEberts
    New Member
    • Mar 2008
    • 51

    Link to open a record in a Form

    Subject: Trying to open up a record in a form called "fmappointm ent" when clicking on a "looks like hyperlink" text box called "ContactID"

    I have made many instances of this in my database but in this case I am having a setup problem and getting the error "insert perameter"
    NOTE: when I do insert the record number in the pop up box the correct record does show

    What I have
    Text Box - "ContactID" on "Datessubfo rm"
    Main Form -"Frmcalenda r"
    Subform - "Datessubfo rm" inserted into "Frmcalenda r"

    (1) I have made a macro in the text box of "contactId" which I have made to look like a hyperlink on "Datessubfo rm"

    (2) In the "click" event I have inserted
    [contactID]=[forms]![FrmCalendar]![Datessubform]![contactid]

    NOTE: The main form is a calendar "frmcalenda r" with 37 subforms "datessubfo rm" that is a continous form with names "SF1 thru SF37"

    I have tried many, many variations to make this work with no luck. The closest I can get is to open up the first record in the "fmappointm ent" not the one I am requesting.

    I have tried to give as much information as possible - if more is needed please ask.

    Time for me to ask the pros for some advice!

    Thanks
    Gary
  • nico5038
    Recognized Expert Specialist
    • Nov 2006
    • 3080

    #2
    Your assignment:
    [contactID]=[forms]![FrmCalendar]![Datessubform]![contactid]
    should be:
    [contactID]=[forms]![FrmCalendar]![Datessubform]!Form![contactid]
    when activated in the main form.
    Else use:
    [contactID]=Me![contactid]

    Just check: Forms: Refer to Form and Subform properties and controls
    (Many other useful info there :-)

    Nic;o)

    Comment

    • GLEberts
      New Member
      • Mar 2008
      • 51

      #3
      Nic;o)
      Thanks for the suggesstions. unfortunately they gave me the same result with a paramenter error.
      I will research the link you supplied.
      thanks
      Gary

      Comment

      • nico5038
        Recognized Expert Specialist
        • Nov 2006
        • 3080

        #4
        Hmm, the "parameter request" often points to a wrong field name in a query / form's record source. Did you check that ?
        Just try to find the field the popup refers to and check or that field is in the table.

        Nic;o)

        Comment

        • FishVal
          Recognized Expert Specialist
          • Jun 2007
          • 2656

          #5
          Originally posted by GLEberts
          ....
          (2) In the "click" event I have inserted
          [contactID]=[forms]![FrmCalendar]![Datessubform]![contactid]

          ....
          Did you "insert" this expression to OnClick property or to event handling code?

          Comment

          • GLEberts
            New Member
            • Mar 2008
            • 51

            #6
            What I did is:
            (1) Used the Wizard Macro builder
            (2) Inserted the Macro into the "OnClick" for CONTACTID
            (3) Used open form for the action
            (4) in the where condition inserted contactID]=[forms]![FrmCalendar]![Datessubform]![contactid]


            Some other information:
            I am running the form off a query not a table

            2nd Part
            I have double checked the pop up which is "Enter Parameter Value" which in this case refers to the "contactId" when I do insert the contactid that I want the correct record comes up.
            I have gone through the query,table and form - had no luck coming across any mispelled words or wrong inputs.

            Thanks
            Gary

            Comment

            • nico5038
              Recognized Expert Specialist
              • Nov 2006
              • 3080

              #7
              As stated before, the condition should be:
              [contactID]=[forms]![FrmCalendar]![Datessubform]!Form![contactid]

              When this doesn't work, can you take a screen shot of the "param" message and attach that here?

              Nic;o)

              Comment

              • GLEberts
                New Member
                • Mar 2008
                • 51

                #8
                I have attached a copy of the screen when the pop up comes up.
                Thanks for reviewing it.
                Gary
                Attached Files

                Comment

                • nico5038
                  Recognized Expert Specialist
                  • Nov 2006
                  • 3080

                  #9
                  I'm interested in the exact message text, so just the popup will do.
                  This is too small to read :-)

                  Nic;o)

                  Comment

                  • GLEberts
                    New Member
                    • Mar 2008
                    • 51

                    #10
                    the pop up says

                    Enter Parameter Value
                    forms!frmcalend ar!datessubform !form!contactId

                    Gary

                    Comment

                    • FishVal
                      Recognized Expert Specialist
                      • Jun 2007
                      • 2656

                      #11
                      Originally posted by GLEberts
                      ....

                      NOTE: The main form is a calendar "frmcalenda r" with 37 subforms "datessubfo rm" that is a continous form with names "SF1 thru SF37"

                      ....
                      Does it mean form having name [datessubform] is embedded in 37 Subform controls having names "SF1 thru SF37"?

                      Comment

                      • GLEberts
                        New Member
                        • Mar 2008
                        • 51

                        #12
                        yes that is correct.

                        Reference: I am using the shell of the calendar on the thread:

                        "Ms Access Calendar"
                        MyWaterloo

                        Thanks for your help!
                        Gary

                        Comment

                        • FishVal
                          Recognized Expert Specialist
                          • Jun 2007
                          • 2656

                          #13
                          So, you should use Subform control name in your reference instead fo form name.
                          for example
                          [forms]![FrmCalendar]![SF1]!Form![contactid]
                          instead of
                          [forms]![FrmCalendar]![Datessubform]!Form![contactid]

                          Comment

                          • GLEberts
                            New Member
                            • Mar 2008
                            • 51

                            #14
                            I noticed that you did not use brackets around "Form"
                            [forms]![FrmCalendar]![SF1]!Form![contactid]

                            when I input that and then save - it automatically puts brackets around [form]

                            then gives me the "Enter Parameter Value" with
                            [forms]![frmcalendar]![SF1]![Form]![ContactID]

                            I have tried that variation along with others with no success

                            Below is the closest thing I can use that does not bring up the "Enter Paramenter Value" pop up box.

                            however it takes me to the first record in the table - not the one that I am clicking on.

                            [contactid]=[Forms]![FrmCalendar]![SF1].[Form].[contactid]

                            after researching the "enter paramenter value" pop up it seems that it comes back to the same thing - table, query or form value.

                            I have gone back through everything over and over again and can not find anything wrong with any imputs of names in any of the above.

                            I am using this feature to click on a text box and open up a form with the record in a few other places in the database with no issues. Even searching the same table "tblappointment s".

                            seems that I am missing something very simple and can't grasp it.

                            frustrated
                            Gary

                            Comment

                            • nico5038
                              Recognized Expert Specialist
                              • Nov 2006
                              • 3080

                              #15
                              I should start with warning you that you're trying to rebuild Outlook and that I personally would use Outlook and interface my Access .mdb with automation.

                              One solution is to drop your macro and use VBA instead.
                              Just code in the OnClick event of the field contactid on the Datessubform:
                              Code:
                              DoCmd.Openform "fmappointment",,,"[contactid]="& Me.contactid
                              Nic;o)

                              Comment

                              Working...