Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2004

    Question Unanswered: Toggle "hold" button for form

    I have created a database that takes user inputs from combo boxes on a form and puts them into a table. I would like to know if there is some way I can put a "hold" button (toggle button) on the form for each of the combo boxes to keep the value there (in the combo box).

    Ie - If someone enters the values:

    Date: 29 Nov 04
    Venue: Gold Coast
    Person: J Timberlake

    and they want to make the next record:

    Date: 29 Nov 04
    Venue: Gold Coast
    Person: C Aguilera

    I would like the user to have a "hold" button to keep the Date and Venue values the same so they dont have to find them in the combo box again.

    Can anyone help out?

    Cheers, JJ xox
    Last edited by Blondage; 11-25-04 at 22:09.

  2. #2
    Join Date
    Dec 2002
    Préverenges, Switzerland
    add two text boxes txt1, txt2 and two checkboxes chk1, chk2
    assuming your combos are cbo1, cbo2...

    .visible = No for the two text boxes
    .default = False for the two checkboxes

    private sub chk1_AfterUpdate()
    if chk1 then
    txt1 = cbo1
    text1 = null
    end sub

    and similarly for chk/txt/cbo 2

    to "paste" any values the user elected to retain:
    cbo1 = txt1
    cbo2 = txt2

    you have to find somewhere to put those two lines (it depends on how you are creating the new record). i you can't find a decent event, add a button "Paste" and put the two lines in it's _Click() event.

    currently using SS 2008R2

  3. #3
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    Like the approach
    an alternative is
    1) to define public varailables in the forms declarations
    2) store the values of the columns (fields / variables) you want to retain in the forms "after update event"
    3) in either the forms "before insert", or "after insert" events (I forget which) place some code which loads the new record with the retained varaibles

    option explict
    Dim strDefaultVenue as string
    Dim strDefaultPerformer as string
    Dim datDefaultEventDate
    ..... insert the rest of code

    Private Sub Form_AfterUpdate()
    if not isnull([Venue]) then strdefaultvenue=[Venue]
    if not isnull([Performer]) then .......
    ...insert any other code required
    end sub

    Private Sub Form_BeforeInsert(Cancel As Integer)
    if not isnull[(strDefaultVenue)] then [venue]=strdefaultvenue
    End Sub

    This assumes that the items in the square brackerts are the column names in the recordset, and hopefully the name of the control

Posting Permissions

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