Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Join Date
    Dec 2005
    Location
    Somewhere on the 3rd Rock
    Posts
    93

    Question Unanswered: dropdown menu to stay the same for each record (was "Can I do this")

    I have a form with about 10 fields to input data. one of the fields is a dropdown menu. I want that field to stay the same for each record until it is manually changed by selecting a new choice.

    example:
    record 1 --> Choice is A
    record 2 --> Choice is A (remains the same as the last record)
    record 3 --> Choice is A (remains the same as the last record)
    record 4 --> I change choice to C
    record 5 --> the choice will remain C until changed again

    was messing around with the Default value, but didn't get anywhere. Maybe someone can get me headed in the right direction.

    Thanks
    Will Dove
    working hard is better then hardly working ...

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    And to what scope is this behaviour to operate to? Is it only while the form is currently running? Is this to work like this for all sessions? Basically, what is the lifetime for this feature?

    2 strategies:

    1) form level variable that hold the current choice. When doing new, set to
    the choice as default.

    2) Same thing except that it's stored in a table somewhere ... upon form load, retrieve choice. upon form exit save last choice.
    Back to Access ... ADO is not the way to go for speed ...

  3. #3
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926

    Default

    I think what M Own is getting at is something like this:

    1. On your form have a field which is combobox with the values you want in the valuelist (or a plain textbox or an option group, etc.) This field is unbound (no controlsource). If, as M Owen stated, if you want to store the default for the next time you open the form, when you open the form, set the value of your combobox to a value in lookup type table (i.e. In the On_Open event of the form -- me!MyComboBox = dlookup("[DefaultValueField]","[DefaultValueTable]") where upon when you close the form, you would need to write a bit of code to write the current value in the MyCombobox field to the DefaultValueTable (updating the 1 record in it, not appending to it - You'll need to start by having 1 record in that table).
    2. The field where you want to store the value in the real table has the Default property set to equal the MyCombobox. When the MyCombobox is changed, you have a bit of code which sets the real field to the new value in the combobox (i.e. me!MyField = me!MyCombobox). Note: I'm not sure but you may also have to set the real field = to me!MyCombobox when the form first opens as I don't know if it will see the default value in MyCombobox when the form first opens.
    3. If you close the form and want to save the value in the combobox for the next time you open the form, you write a snippet of code (or query) which updates the DefaultValueField in the DefaultValueTable.

    Sorry if I misread you M Owen (and hope I didn't totally confuse sailest), I just got bored here at work and needed to respond to a few threads.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  4. #4
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by pkstormy
    I think what M Own is getting at is something like this:

    1. On your form have a field which is combobox with the values you want in the valuelist (or a plain textbox or an option group, etc.) This field is unbound (no controlsource). If, as M Owen stated, if you want to store the default for the next time you open the form, when you open the form, set the value of your combobox to a value in lookup type table (i.e. In the On_Open event of the form -- me!MyComboBox = dlookup("[DefaultValueField]","[DefaultValueTable]") where upon when you close the form, you would need to write a bit of code to write the current value in the MyCombobox field to the DefaultValueTable (updating the 1 record in it, not appending to it - You'll need to start by having 1 record in that table).
    2. The field where you want to store the value in the real table has the Default property set to equal the MyCombobox. When the MyCombobox is changed, you have a bit of code which sets the real field to the new value in the combobox (i.e. me!MyField = me!MyCombobox). Note: I'm not sure but you may also have to set the real field = to me!MyCombobox when the form first opens as I don't know if it will see the default value in MyCombobox when the form first opens.
    3. If you close the form and want to save the value in the combobox for the next time you open the form, you write a snippet of code (or query) which updates the DefaultValueField in the DefaultValueTable.

    Sorry if I misread you M Owen (and hope I didn't totally confuse sailest), I just got bored here at work and needed to respond to a few threads.
    You read quite well Paul ... And you took the more permanent of the options ... That only leaves the question of what is the desired lifetime for this action?

    - Mike
    Back to Access ... ADO is not the way to go for speed ...

  5. #5
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926

    Lifetime?

    I don't understand what you mean by lifetime of the action M Own? Wouldn't storing the default value of the combobox in a 1 record table be a kind of a permanent lifetime for storing the default value to be retrieved to the form (or am I way off base on your question and meaning of lifetime of the action?)
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  6. #6
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Paul,

    The name is Mike. You can stop calling me M Owen anytime now ... As for the lifetime, I gave 2 options: quasi-permanent where you store the current/next/future choice external to the form. ALSO, the other option was for that choice to be local to the form (where it would be in effect ONLY during the current session in operation resetting upon the next run of the form). That is lifetime ...
    Back to Access ... ADO is not the way to go for speed ...

  7. #7
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926

    Lifetime

    Got it Mike (not used to seeing your name at the bottom - only that you respond to a very lot of threads and wondering how you find the time to answer so many - thanks by the way for the help in the past).

    Re: Lifetime

    1. quasi-permanent = storing the unbound combobox value in a table which is retrieved when the form opens.

    2. local to the form = you don't store the unbound combobox value in a table.

    I thought I related to both options in my initial response.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  8. #8
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Paul:

    Hmmmm .... Looks like you talked about permanence (saving choice outside of the form) and the "local" option within that framework ... Or else I just got lost in there somewhere ...

    As for your last observation, when you're out looking for problemsolving inspiration, sometimes you can't help but answer some issues that are rather easy to explain ... My luck has been that my questions go unanswered because they are rather unique and/or difficult ans as I have no need to post simple easy questions ... That is not to say that my friends out here don't chip in and try to help out ... (like trying to dup a 3343 RTE) That one is still my current SOB headache ... Reason? Cause if I FIND a way to dup it, that may not be how it happened ... There is nothing more fun that trying to prove a negative condition ... Some days it really SUCKS to be good.
    Back to Access ... ADO is not the way to go for speed ...

  9. #9
    Join Date
    Dec 2005
    Location
    Somewhere on the 3rd Rock
    Posts
    93

    While form is open

    I need to make the choice last only as long as the form is open, or as long as it is not changed.

    I the choice will be placed in table with the other parts of that record. I don't want the form to open with a default value, I want it to open with the choice blank, so the user has to select a choice. Then once they select a choice I want it to remain that until the user changes it or closes the form.

    Thanks for all the answers, it seems that the question can I? should have been, what is the most effective way to do this?
    Will Dove
    working hard is better then hardly working ...

  10. #10
    Join Date
    Dec 2005
    Location
    Somewhere on the 3rd Rock
    Posts
    93

    Please explain

    How would I use the Form level method?

    Quote Originally Posted by M Owen
    And to what scope is this behaviour to operate to? Is it only while the form is currently running? Is this to work like this for all sessions? Basically, what is the lifetime for this feature?

    2 strategies:

    1) form level variable that hold the current choice. When doing new, set to
    the choice as default.

    2) Same thing except that it's stored in a table somewhere ... upon form load, retrieve choice. upon form exit save last choice.
    Will Dove
    working hard is better then hardly working ...

  11. #11
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by saileast
    How would I use the Form level method?
    Make a form level variable that would hold your choice ... This will (by nature) mean that that choice is only saved for the duration that the form session is open. As soon as you close the form, the choice is lost for any futher duplication ...
    Back to Access ... ADO is not the way to go for speed ...

  12. #12
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Wotcha chaps.

    Perhaps I am missing something but doesn't the combo value have to be stored in an array storing the record key and the combo value or something similar (e.g. in the table and then wiped on close and open)? Just storing the "current" combo value wouldn't work if the user (using saileast's example) went from record 5 back to record 1. Like so:

    record 1 --> Choice is A
    record 2 --> Choice is A (remains the same as the last record)
    record 3 --> Choice is A (remains the same as the last record)
    record 4 --> I change choice to C
    record 5 --> the choice will remain C until changed again
    record 1 --> Choice is STILL A

    Or is that what you meant anyway?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  13. #13
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by pootle flump
    Wotcha chaps.

    Perhaps I am missing something but doesn't the combo value have to be stored in an array storing the record key and the combo value or something similar (e.g. in the table and then wiped on close and open)? Just storing the "current" combo value wouldn't work if the user (using saileast's example) went from record 5 back to record 1. Like so:

    record 1 --> Choice is A
    record 2 --> Choice is A (remains the same as the last record)
    record 3 --> Choice is A (remains the same as the last record)
    record 4 --> I change choice to C
    record 5 --> the choice will remain C until changed again
    record 1 --> Choice is STILL A

    Or is that what you meant anyway?
    Poots ... Nope. After every selection, the last choice is updated ... Basically just an ongoing dup ... BTW, think I blew mmbosman's mind with that code I posted yesterday????
    Back to Access ... ADO is not the way to go for speed ...

  14. #14
    Join Date
    Dec 2005
    Location
    Somewhere on the 3rd Rock
    Posts
    93
    Quote Originally Posted by pootle flump
    Wotcha chaps.

    Perhaps I am missing something but doesn't the combo value have to be stored in an array storing the record key and the combo value or something similar (e.g. in the table and then wiped on close and open)? Just storing the "current" combo value wouldn't work if the user (using saileast's example) went from record 5 back to record 1. Like so:

    record 1 --> Choice is A
    record 2 --> Choice is A (remains the same as the last record)
    record 3 --> Choice is A (remains the same as the last record)
    record 4 --> I change choice to C
    record 5 --> the choice will remain C until changed again
    record 1 --> Choice is STILL A

    Or is that what you meant anyway?
    I want just the choice to remain the same when the user tabs to a new record, I do want that choice to be put in the record table for that form.

    Basically instead of having a user select the same item from the dropdown, say 100 times a day, I want them to be able to select that choice and leave it until they need to change it. Most of the users will be entering aroung 45 records a day and really dont like having to select the same choice each time. Kinda like the date and time field, I defaulted it to Now() so they didn't have to enter the date and time for each record, they just click on new record when they are ready to enter it and the Date and time is automatically entered, but they can edit it if they need to.

    a simple way is to say the dropdown is (North, South, East, West, Carolina Forest, River Oaks, Dist 3, etc....) if the person entering the data is entering data for North, They don't want to have to select North everytime, they just want to tab thru the field and move to the next field, (something to speed up data entry). But I do need all the records entered for North to stay as north when the user changes and starts to enter data for South, etc.....

    I did get a code to work somewhat, [field] = A_Last, however, this will change all the records that the user accesses to the last selected option, I don't want it to do this. I put the following code in:
    Code:
    Private Sub LookupChoice_KeyDown(KeyCode As Integer, Shift As Integer)
    LookupChoice = A_LAST
    End Sub
    Last edited by saileast; 07-23-06 at 14:02.
    Will Dove
    working hard is better then hardly working ...

  15. #15
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Sounds to me the scope needs reassessing....

    Quote Originally Posted by M Owen
    BTW, think I blew mmbosman's mind with that code I posted yesterday????
    Lol - seems likely.
    Testimonial:
    pootle flump
    ur codings are working excelent.

Posting Permissions

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