Default Value from a Lookup Table

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

    #1

    Default Value from a Lookup Table

    I want to set a default value in a table called "Quotes" for a field
    called "Source."

    The "Source" field uses a lookup table called "Source" which looks
    like this:

    Sourceabbrev Sourcename
    BX-MI BUILDERS EXCHANGE MI
    BX-OH BUILDERS EXCHANGE OH
    CNS-MI CONSTRUCTION NEWS SERVICE MI
    DODGE-MI DODGE MI
    OTHER OTHER


    I want the default to be "OTHER". What do I need to enter in the
    "Quotes" "Source" default value line to get this to happen?

    I need the exact syntax since I've tried several things and keep
    getting syntax or other errors.

    Thanks,
    Tina

  • James

    #2
    Re: Default Value from a Lookup Table

    Hi

    Unless I've misunderstood you should just be able to enter "OTHERS" as
    the default value

    Thanks
    James



    On 13 Jun, 15:52, TinaF <tferr...@uisco rp.comwrote:
    I want to set a default value in a table called "Quotes" for a field
    called "Source."
    >
    The "Source" field uses a lookup table called "Source" which looks
    like this:
    >
    Sourceabbrev Sourcename
    BX-MI BUILDERS EXCHANGE MI
    BX-OH BUILDERS EXCHANGE OH
    CNS-MI CONSTRUCTION NEWS SERVICE MI
    DODGE-MI DODGE MI
    OTHER OTHER
    >
    I want the default to be "OTHER". What do I need to enter in the
    "Quotes" "Source" default value line to get this to happen?
    >
    I need the exact syntax since I've tried several things and keep
    getting syntax or other errors.
    >
    Thanks,
    Tina

    Comment

    • TinaF

      #3
      Re: Default Value from a Lookup Table

      On Jun 13, 9:57 am, James <james_no_spam_ ple...@yahoo.co .ukwrote:
      Hi
      >
      Unless I've misunderstood you should just be able to enter "OTHERS" as
      the default value
      >
      Thanks
      James
      >

      >
      On 13 Jun, 15:52, TinaF <tferr...@uisco rp.comwrote:
      >
      I want to set a default value in a table called "Quotes" for a field
      called "Source."
      >
      The "Source" field uses a lookup table called "Source" which looks
      like this:
      >
      Sourceabbrev Sourcename
      BX-MI BUILDERS EXCHANGE MI
      BX-OH BUILDERS EXCHANGE OH
      CNS-MI CONSTRUCTION NEWS SERVICE MI
      DODGE-MI DODGE MI
      OTHER OTHER
      >
      I want the default to be "OTHER". What do I need to enter in the
      "Quotes" "Source" default value line to get this to happen?
      >
      I need the exact syntax since I've tried several things and keep
      getting syntax or other errors.
      >
      Thanks,
      Tina
      I can't do that because the data type is set to Number. So I'm
      assuming it uses the row number. I did not set up this database,
      someone else did before I worked here.

      Comment

      • salad

        #4
        Re: Default Value from a Lookup Table

        TinaF wrote:
        On Jun 13, 9:57 am, James <james_no_spam_ ple...@yahoo.co .ukwrote:
        >
        >>Hi
        >>
        >>Unless I've misunderstood you should just be able to enter "OTHERS" as
        >>the default value
        >>
        >>Thanks
        >>James
        >>
        >>http://www.jamesoleary.co.uk/
        >>
        >>On 13 Jun, 15:52, TinaF <tferr...@uisco rp.comwrote:
        >>
        >>
        >>>I want to set a default value in a table called "Quotes" for a field
        >>>called "Source."
        >>
        >>>The "Source" field uses a lookup table called "Source" which looks
        >>>like this:
        >>
        >>>Sourceabbr ev Sourcename
        >>>BX-MI BUILDERS EXCHANGE MI
        >>>BX-OH BUILDERS EXCHANGE OH
        >>>CNS-MI CONSTRUCTION NEWS SERVICE MI
        >>>DODGE-MI DODGE MI
        >>>OTHER OTHER
        >>
        >>>I want the default to be "OTHER". What do I need to enter in the
        >>>"Quotes" "Source" default value line to get this to happen?
        >>
        >>>I need the exact syntax since I've tried several things and keep
        >>>getting syntax or other errors.
        >>
        >>>Thanks,
        >>>Tina
        >
        >
        I can't do that because the data type is set to Number. So I'm
        assuming it uses the row number. I did not set up this database,
        someone else did before I worked here.
        >
        Are you saying that the Source field in table Quotes is numeric? And
        the SourceTable has no numeric or autonumber fields in it? That seems odd.

        Well, if it's using numbers then, look for a quote record with the
        Source = Other. I suppose that would be a 4 based on the record list of
        the source table you provide. Try 1,2, or 3 if that doesn't work.

        I suppose if that's the way it's done you can find some code that
        converts the numbers to text and visa versa. Seems like a bunch of work
        when one could have used a lookup table. Or perhaps it is using a combo
        box to select and the rowsource type (open property sheet of combo,
        click Data tab) is ValueList instead of Table/Query. If so, determine
        the number associated to the value list.

        Comment

        • DavidB

          #5
          Re: Default Value from a Lookup Table

          On Jun 13, 10:57 am, James <james_no_spam_ ple...@yahoo.co .ukwrote:
          Hi
          >
          Unless I've misunderstood you should just be able to enter "OTHERS" as
          the default value
          >
          Thanks
          James
          >

          >
          On 13 Jun, 15:52, TinaF <tferr...@uisco rp.comwrote:
          >
          >
          >
          I want to set a default value in a table called "Quotes" for a field
          called "Source."
          >
          The "Source" field uses a lookup table called "Source" which looks
          like this:
          >
          Sourceabbrev Sourcename
          BX-MI BUILDERS EXCHANGE MI
          BX-OH BUILDERS EXCHANGE OH
          CNS-MI CONSTRUCTION NEWS SERVICE MI
          DODGE-MI DODGE MI
          OTHER OTHER
          >
          I want the default to be "OTHER". What do I need to enter in the
          "Quotes" "Source" default value line to get this to happen?
          >
          I need the exact syntax since I've tried several things and keep
          getting syntax or other errors.
          >
          Thanks,
          Tina- Hide quoted text -
          >
          - Show quoted text -
          You need to set an autonumber (random) primary key in the Source table
          and call it SourceID. Then in the Quote table (table names should be
          singular ergo Quote would be the name to use for this table not
          Quotes) set the default value of the Status field to the value of the
          SourceID for the "Other" source in the Source table. You should
          actually change the field name in the Quote table to SourceID since
          that is what it stores and not the actual Source name. Welcome to
          the world of relational databases. While you are at it set yoru
          relationships!


          Comment

          Working...