• Default value in dropdown (2000)

    • This topic has 49 replies, 5 voices, and was last updated 21 years ago.
    Author
    Topic
    #403759

    Hi,

    I am using a drop down system and would like a default value to appear in this drop down.
    I have tried to do this but cannot work out how it is done.
    see attachment.

    Justin.

    Viewing 3 reply threads
    Author
    Replies
    • #815860

      You should be able to set the Default Value property of the combo box in the Data tab of the Properties window, but what exactly to put there depends on other properties of the combo box. If the Column Count property (in the Format tab of Properties) is 1, you should be able to enter the value you want to see in Default Value. If, however, Column Count is greater than 1, and the Column Widths property tells you that the first column has width 0, you should not enter the value you want to see, but the corresponding value of the hidden first column.

      If you need more assistance, please provide the following information for the combo box (not as a screenshot, but as text in a reply):
      From the Format tab:
      – Column Count
      – Column Widths
      From the Data tab:
      – Row Source Type
      – Row Source
      – Bound Column

      • #816748

        I have resolved this problem.
        See thread from Don Sadler

        Regards
        Justin.

      • #816749

        I have resolved this problem.
        See thread from Don Sadler

        Regards
        Justin.

      • #816803

        When clicking on the dropdown list the default value does not appear to be showing , any ideas as to why not?
        Information you required.

        From the Format tab:
        – Column Count: 0
        – Column Widths: 2.54 cm
        From the Data tab:
        – Row Source Type: Table/Query
        – Row Source: SELECT [Names Docs Review].[names] FROM [Names Docs Review];
        – Bound Column: 1

        • #816811

          – Column Count: 0

          That is very strange, Column Count can only be a value in the range 1 through 255. Try setting it to 1, then enter the Default Value property again.

          Note: Default Value only works for new records, not for existing records.

          • #816821

            I have changed this but now l get an error.

            Justin

            • #816827

              Could you post a stripped down version of your database? You know the recipe by now. Please remove superfluous items, but don’t strip away so much that the combo box doesn’t work any more.

            • #816828

              Could you post a stripped down version of your database? You know the recipe by now. Please remove superfluous items, but don’t strip away so much that the combo box doesn’t work any more.

            • #816837

              I would like the default value to be “JACKSON Steve” on the dropdown.
              As this choice is very common.

              Regards
              Justin.

            • #816838

              I would like the default value to be “JACKSON Steve” on the dropdown.
              As this choice is very common.

              Regards
              Justin.

            • #816857

              You have set the Default Value property to

              [Current Owner].[itemdata](“JACKSON Steve”)

              This is meaningless (and not what Don Sadler intended.) Since you want a fixed value, you should set the Default Value simply to

              “JACKSON Steve”

              (including the quotes; if you omit them, Access will add them again.)

            • #817260

              That works fine.

              Thanks
              Justin.

            • #817261

              That works fine.

              Thanks
              Justin.

            • #816858

              You have set the Default Value property to

              [Current Owner].[itemdata](“JACKSON Steve”)

              This is meaningless (and not what Don Sadler intended.) Since you want a fixed value, you should set the Default Value simply to

              “JACKSON Steve”

              (including the quotes; if you omit them, Access will add them again.)

          • #816822

            I have changed this but now l get an error.

            Justin

        • #816812

          – Column Count: 0

          That is very strange, Column Count can only be a value in the range 1 through 255. Try setting it to 1, then enter the Default Value property again.

          Note: Default Value only works for new records, not for existing records.

      • #816804

        When clicking on the dropdown list the default value does not appear to be showing , any ideas as to why not?
        Information you required.

        From the Format tab:
        – Column Count: 0
        – Column Widths: 2.54 cm
        From the Data tab:
        – Row Source Type: Table/Query
        – Row Source: SELECT [Names Docs Review].[names] FROM [Names Docs Review];
        – Bound Column: 1

    • #815861

      You should be able to set the Default Value property of the combo box in the Data tab of the Properties window, but what exactly to put there depends on other properties of the combo box. If the Column Count property (in the Format tab of Properties) is 1, you should be able to enter the value you want to see in Default Value. If, however, Column Count is greater than 1, and the Column Widths property tells you that the first column has width 0, you should not enter the value you want to see, but the corresponding value of the hidden first column.

      If you need more assistance, please provide the following information for the combo box (not as a screenshot, but as text in a reply):
      From the Format tab:
      – Column Count
      – Column Widths
      From the Data tab:
      – Row Source Type
      – Row Source
      – Bound Column

    • #815870

      This may not work in every circumstance but it works for me… In the combo box properties, data tab, default value, use the following:

      [ComboBoxName].[itemdata](XXX)

      where Comboboxname = the name of your combox and XXX = the row in your lookup table (assuming your combo box is based on a table or query) that contains your desired value. In determing the row, remember that it starts with zero.

      • #816098

        It only starts at zero if you have column heads turned off. If they are turned on, the item count should start at 1 or you will return the column header.

      • #816099

        It only starts at zero if you have column heads turned off. If they are turned on, the item count should start at 1 or you will return the column header.

      • #816744

        That works great. Thanks.

        Justin.

      • #816745

        That works great. Thanks.

        Justin.

      • #816783

        I appear to be getting an error now.
        Any ideas as to what is causing this?
        see attahment.

        Justin.

      • #816784

        I appear to be getting an error now.
        Any ideas as to what is causing this?
        see attahment.

        Justin.

    • #817023

      I have been working on the same type of problem. However, I’d like my dropdown box to have a default value based on the value of another field (whether or not that field is “null”). example: IF txt2DefFullName is null then cboRespParty = “1Defendant”. AND I’d like this happen the the click event of a check box.
      I’ve tried several things but no “hits” so far.
      Charlotte

      • #817032

        Let’s try to get the terminology straight. The Default Value property of a field determines the value this field will have in a new record, before data have been entered in that record. I’m not sure that is what you mean by “default value”. If txtDefFullName is bound to a field, it makes no sense to have the default value of another field depend on it. I also don’t understand what the check box has to do with it.

        • #817046

          Thanks for your help, Hans. Understanding the definition of “defaut value” does help. So, now I’ll try to give you an understanding of what I’m trying to do.
          I have a record in a table. There may be 1 defendant, or there could be 2. This record was created at some previous date.
          Now, I have a new form (based on this old data) and I need to enter additional information. When the user does a search for a particular name, and then Selects this record as the one they want to deal with (clicking the check box “ckJGF”) THEN I’d like Access to analyze the data, if there is only 1 defendant (txt2DefFullName will be null) automatically enter “1Defendant” in cboRespParty (so the user doesn’t have to).
          So, whether or not “1Defendant” is automatically “entered” into cboRespParty will depend on two things: 1) if txt2DefFullName is null and 2) if the user wants to work with this record (clicking ckJGF). confused

          • #817062

            OK, this should be done (as you indicated in your first post in this thread) in the On Click (or After Update) event of the check box. The exact code depends on the way the combo box has been set up (like in Justin’s case). What are the following properties of cboRespParty?

            From the Format tab:
            – Column Count
            – Column Widths
            From the Data tab:
            – Row Source Type
            – Row Source
            – Bound Column

            • #817070

              – Column Count
              – Column Widths

            • #817093

              Sorry, what I meant was: what are the values of the properties I mentioned for your combo box? If you select the combo box in design view, you can look up the values in the Properties window.

            • #817111

              Sorry….

              – Column Count = 2
              – Column Widths = 1″; 0″

            • #817113

              And the others?

            • #817121

              both the drop down boxes have the same values
              – Column Count = 2
              – Column Widths = 1″; 0″

              they are both bound to the same qry

              All the other information is coming from a table “tbl1DebtorInfo” and corresponding qry
              the check box “ckJGF” is bound to a Yes/No field on the table
              txtDef1FullName and txtDef2FullName fields are bound to a qry based on “tbl1DebtorInfo”
              I’ve combined three fields to make a Full name field
              “Def1FullName: [fldDef1FirstName] & ” ” & [fldDef1MName] & ” ” & [fldDef1LastName]”

              That that what you need?

            • #817127

              A few posts ago, I also asked for the following properties of the combo box:

              From the Data tab:
              – Row Source Type
              – Row Source
              – Bound Column

              Where does the second combo box come into this? (BTW, combo box is the “official” term for a dropdown box)

            • #817129

              I knew combo box was the official term, but everyone else was calling it a “drop down”, so I did too… monkey see, monkey do.

              cboRespParty
              – Row Source Type = Table/Query
              – Row Source = qryRespParty
              – Bound Column = 1

              Thre are two combo boxes, exactly the same. One is on a subform.
              subform name is sfrmJudgmentFees

            • #817133

              As far as I can see from the information you provided, the following should do what you want:
              – Open the form in design view.
              – Select the check box ckJGF.
              – Activate the Event tab of the Properties window.
              – Click in the On Click event, and select [Event Procedure] from the dropdown list.
              – Click the builder button (the three dots … to the right of the dropdown arrow.)
              – Make the event procedure look like this:

              Private Sub ckJGF_Click()
              If Me.ckJGF = True And IsNull(Me.txt2DefFullName) Then
              Me.cboRespParty = “1Defendant”
              End If
              End Sub

              (You didn’t state that you want the combo box to be set to “2Defendant” otherwise, so the code does not do that.)

            • #817139

              Thank you so much. I will give that a try. I tried something like that … I think I left something out.
              If it doesn’t meet the criteria, then I don’t want anything.

              Thanks.

            • #817140

              Thank you so much. I will give that a try. I tried something like that … I think I left something out.
              If it doesn’t meet the criteria, then I don’t want anything.

              Thanks.

            • #817134

              As far as I can see from the information you provided, the following should do what you want:
              – Open the form in design view.
              – Select the check box ckJGF.
              – Activate the Event tab of the Properties window.
              – Click in the On Click event, and select [Event Procedure] from the dropdown list.
              – Click the builder button (the three dots … to the right of the dropdown arrow.)
              – Make the event procedure look like this:

              Private Sub ckJGF_Click()
              If Me.ckJGF = True And IsNull(Me.txt2DefFullName) Then
              Me.cboRespParty = “1Defendant”
              End If
              End Sub

              (You didn’t state that you want the combo box to be set to “2Defendant” otherwise, so the code does not do that.)

            • #817130

              I knew combo box was the official term, but everyone else was calling it a “drop down”, so I did too… monkey see, monkey do.

              cboRespParty
              – Row Source Type = Table/Query
              – Row Source = qryRespParty
              – Bound Column = 1

              Thre are two combo boxes, exactly the same. One is on a subform.
              subform name is sfrmJudgmentFees

            • #817128

              A few posts ago, I also asked for the following properties of the combo box:

              From the Data tab:
              – Row Source Type
              – Row Source
              – Bound Column

              Where does the second combo box come into this? (BTW, combo box is the “official” term for a dropdown box)

            • #817122

              both the drop down boxes have the same values
              – Column Count = 2
              – Column Widths = 1″; 0″

              they are both bound to the same qry

              All the other information is coming from a table “tbl1DebtorInfo” and corresponding qry
              the check box “ckJGF” is bound to a Yes/No field on the table
              txtDef1FullName and txtDef2FullName fields are bound to a qry based on “tbl1DebtorInfo”
              I’ve combined three fields to make a Full name field
              “Def1FullName: [fldDef1FirstName] & ” ” & [fldDef1MName] & ” ” & [fldDef1LastName]”

              That that what you need?

            • #817114

              And the others?

            • #817112

              Sorry….

              – Column Count = 2
              – Column Widths = 1″; 0″

            • #817094

              Sorry, what I meant was: what are the values of the properties I mentioned for your combo box? If you select the combo box in design view, you can look up the values in the Properties window.

          • #817063

            OK, this should be done (as you indicated in your first post in this thread) in the On Click (or After Update) event of the check box. The exact code depends on the way the combo box has been set up (like in Justin’s case). What are the following properties of cboRespParty?

            From the Format tab:
            – Column Count
            – Column Widths
            From the Data tab:
            – Row Source Type
            – Row Source
            – Bound Column

        • #817047

          Thanks for your help, Hans. Understanding the definition of “defaut value” does help. So, now I’ll try to give you an understanding of what I’m trying to do.
          I have a record in a table. There may be 1 defendant, or there could be 2. This record was created at some previous date.
          Now, I have a new form (based on this old data) and I need to enter additional information. When the user does a search for a particular name, and then Selects this record as the one they want to deal with (clicking the check box “ckJGF”) THEN I’d like Access to analyze the data, if there is only 1 defendant (txt2DefFullName will be null) automatically enter “1Defendant” in cboRespParty (so the user doesn’t have to).
          So, whether or not “1Defendant” is automatically “entered” into cboRespParty will depend on two things: 1) if txt2DefFullName is null and 2) if the user wants to work with this record (clicking ckJGF). confused

      • #817033

        Let’s try to get the terminology straight. The Default Value property of a field determines the value this field will have in a new record, before data have been entered in that record. I’m not sure that is what you mean by “default value”. If txtDefFullName is bound to a field, it makes no sense to have the default value of another field depend on it. I also don’t understand what the check box has to do with it.

    Viewing 3 reply threads
    Reply To: Default value in dropdown (2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: