linking subforms by a specific value

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • kkrizl

    #1

    linking subforms by a specific value

    I have a form that shows burglar alarm permits. I have a subform that
    shows the alarms that have occurred at the location of the permit
    (linked by permit number). There is a different fine schedule for false
    alarms for burglar alarms vs. panic alarms. I thought I could just
    create an alarm type field and add an additional subform so that
    burglar alarms appear in the first subform, and panic alarms appear in
    the second subform. I tried filtering the subforms by alarm type, but
    I couldn't get the filter to save. I tried having the subforms based
    on queries that separate the alarm types, but I had problems defaulting
    the alarm types when adding new entries. I'm now thinking about
    creating two separate alarm files, but then I'll have to update a bunch
    of other stuff. What would be the best approach, and how can I get it
    to work?

  • David Lloyd

    #2
    Re: linking subforms by a specific value

    You could use the Link Child Fields and Link Master Fields properties of the
    subform to filter based on alarm type, and any other filter properties.

    --
    David Lloyd
    MCSD .NET
    Award-winning Managed I.T. Services, I.T. Consulting, cloud solutions, database hosting, and A.I. software development for organizations nationwide.


    This response is supplied "as is" without any representations or warranties.


    "kkrizl" <kkrizl@co.el-dorado.ca.us> wrote in message
    news:1115913394 .963151.149900@ z14g2000cwz.goo glegroups.com.. .
    I have a form that shows burglar alarm permits. I have a subform that
    shows the alarms that have occurred at the location of the permit
    (linked by permit number). There is a different fine schedule for false
    alarms for burglar alarms vs. panic alarms. I thought I could just
    create an alarm type field and add an additional subform so that
    burglar alarms appear in the first subform, and panic alarms appear in
    the second subform. I tried filtering the subforms by alarm type, but
    I couldn't get the filter to save. I tried having the subforms based
    on queries that separate the alarm types, but I had problems defaulting
    the alarm types when adding new entries. I'm now thinking about
    creating two separate alarm files, but then I'll have to update a bunch
    of other stuff. What would be the best approach, and how can I get it
    to work?


    Comment

    • kkrizl

      #3
      Re: linking subforms by a specific value

      The Link Child Fields and Link Master Fields properties of the
      subform are set to the fields that link them already (permit number in
      both tables). I know I can specify additional fields by separating
      them with semicolins, but what is the syntax to specify a value for the
      field to be filtered by?

      Comment

      • Bob Quintal

        #4
        Re: linking subforms by a specific value

        "kkrizl" <kkrizl@co.el-dorado.ca.us> wrote in
        news:1115913394 .963151.149900@ z14g2000cwz.goo glegroups.com:
        [color=blue]
        > I have a form that shows burglar alarm permits. I have a
        > subform that shows the alarms that have occurred at the
        > location of the permit (linked by permit number). There is a
        > different fine schedule for false alarms for burglar alarms
        > vs. panic alarms. I thought I could just create an alarm type
        > field and add an additional subform so that burglar alarms
        > appear in the first subform, and panic alarms appear in the
        > second subform. I tried filtering the subforms by alarm type,
        > but I couldn't get the filter to save.[/color]

        Even if you had, you would have encountered the problem of what
        you tried next.

        I tried having the[color=blue]
        > subforms based on queries that separate the alarm types, but I
        > had problems defaulting the alarm types when adding new
        > entries.[/color]

        But you didn't set each subform's alarmtype.defau ltvalue.
        [color=blue]
        > I'm now thinking about creating two separate alarm
        > files, but then I'll have to update a bunch of other stuff.[/color]

        This would not be a smart move. both for maintenance and what if
        you add a third alarm type.
        [color=blue]
        > What would be the best approach, and how can I get it to work?[/color]

        I can suggest two options:
        1) create a new table, containing alarmtype.ID and
        Alarmtype.descr iption. On the single subform, add a combobox for
        the alarmtype, so that it's easy to identify and change
        alarmtypeid.

        2)On your mainform, add hidden textboxes, each containg the
        value of one alarm type. Set the link child fields to
        permitnumber;al armtype and the link parent fields to the
        permitnumber;na meoftextbox containing the alarmtype value you
        want in that subform.

        --
        Bob Quintal

        PA is y I've altered my email address.

        Comment

        • kkrizl

          #5
          Re: linking subforms by a specific value

          I used option 2, and it works great.
          Thanks!

          Comment

          • Larry Linson

            #6
            Re: linking subforms by a specific value

            LinkMasterField s and LinkChildFields must match for the Record to display in
            the Form embedded in the Subform Control. Those properties _are_ a kind of
            filtering. They are not as flexible as a WHERE Clause.

            Larry Linson
            Microsoft Access MVP

            "kkrizl" <kkrizl@co.el-dorado.ca.us> wrote in message
            news:1115919086 .097728.103200@ g44g2000cwa.goo glegroups.com.. .[color=blue]
            > The Link Child Fields and Link Master Fields properties of the
            > subform are set to the fields that link them already (permit number in
            > both tables). I know I can specify additional fields by separating
            > them with semicolins, but what is the syntax to specify a value for the
            > field to be filtered by?
            >[/color]


            Comment

            Working...