Page 1 of 2 12 LastLast
Results 1 to 15 of 26
  1. #1
    5 Star Lounger
    Join Date
    Mar 2004
    Posts
    924
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Automatic selection of value from dropdown (2000)

    Is it possible to automatically select a value from a drop down list if a certain value is selected if another drop down.
    In the attached example l would like to automatically select the name "Petit,Simon" if the drop down containing "SPJ,SMP" is selected.

    Any assistance would be appreciated.

    Justin.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Automatic selection of value from dropdown (2000)

    1. How do you determine that Petit, Simon corresponds to SPJ,SMP? Do you have a table or query that links them, or do you have another method?
    2. Should the user be able to pick a different item in the second combo box after Petit, Simon has been selected automatically, or is the selection fixed?

  3. #3
    5 Star Lounger
    Join Date
    Mar 2004
    Posts
    924
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automatic selection of value from dropdown (20

    1. I have a field "people on review list" , this is bound to a drop down list in an external table which contains a list of people, see attachment 1.

    2. As it is at the moment is that the user is able to select the value in the second combo box , this is how l would like it to remain.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Automatic selection of value from dropdown (20

    OK, but how do I know that the second combo box should be set to PETITT Simon if the user selects SPJ, SMP in the first one? Where can the code find this? Or do you want to spell it out explicitly in the code?

  5. #5
    5 Star Lounger
    Join Date
    Mar 2004
    Posts
    924
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automatic selection of value from dropdown (20

    This is what l thought you might be able to answer Hans.
    Do you know a way of doing this?

    Regards
    Justin.

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Automatic selection of value from dropdown (20

    Do you happen to have a table in your database that relates one to the other, more or less like this?

    <table border=1><td align=center>Field1</td><td align=center>Field2</td><td>SPJ, SMP</td><td>PETITT Simon</td><td>...</td><td>...</td></table>
    If so, what is the name of the table, and what are the names of the relevant fields?
    If not, perhaps you should create such a table.

  7. #7
    5 Star Lounger
    Join Date
    Mar 2004
    Posts
    924
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automatic selection of value from dropdown (20

    I am not entirely sure what you mean by this sort of table.
    I have attached the table which l use for the current list of names , is it possible you could send me a screenshot as to how l could amend this table to look the one you have mentioned in your previous post.

    Justin.

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Automatic selection of value from dropdown (20

    Could you attach a stripped down and zipped copy of your database?

  9. #9
    5 Star Lounger
    Join Date
    Mar 2004
    Posts
    924
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automatic selection of value from dropdown (20

    see attachment.

    Justin

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Automatic selection of value from dropdown (20

    Your must define a way to relate the abbreviations to the names. Add a text field named abbreviaton to the 'names docs review' table and specify the abbreviation for each name:

    <table border=1><td>names docs review</td><td>abbreviation</td><td>PETIT, SIMON</td><td>smp</td><td>jones, paul</td><td>spj</td><td>?</td><td>dwb</td></table>
    You can then use code like the following in the After Update event of the combo box:
    <code>
    Private Sub Combo158_AfterUpdate()
    Dim strOwner As String
    If IsNull(Me.Combo158) Then
    Me.Current_Owner = Null
    Else
    strOwner = Split(Me.Combo158, ",")(0)
    Me.Current_Owner = DLookup("[names docs review]", _
    "[names docs review]", _
    "abbreviation =" & Chr(34) & strOwner & Chr(34))
    End If
    End Sub</code>

  11. #11
    5 Star Lounger
    Join Date
    Mar 2004
    Posts
    924
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automatic selection of value from dropdown (20

    I have done as you mentioned but appear to get an error.
    Not to sure what it means (see attachment).

    Justin

  12. #12
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Automatic selection of value from dropdown (20

    In the database you attached, 'names docs review' is the name of both the table and of the (first) field in it. Does the table or the field have a different name in your 'real' database?

    I have attached your stripped down database with the field added to the table and the code added to the form. Works OK for me.

  13. #13
    5 Star Lounger
    Join Date
    Mar 2004
    Posts
    924
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automatic selection of value from dropdown (20

    That was the problem Hans, thanks for that.

    Justin.

  14. #14
    5 Star Lounger
    Join Date
    Mar 2004
    Posts
    924
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automatic selection of value from dropdown (20

    Is is possible to also put todays date into the "Date Given to Owner" field when l select a name from the dropdown?
    see attachment.

    Justin

  15. #15
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Automatic selection of value from dropdown (20

    Yes, just add a line

    Me.[NameOfTheDateTextBox] = Date

    to the After Update event of the combo box. Replace NameOfTheDateTextBox with the actual name of the textbox you indicated in your screenshot.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •