Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Jan 2005
    Location
    Wichita, Kansas, USA
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have a combo box “Combo4” bound to “CommitteeID” field in Table “tblAssignments”.
    After a choice is made in that combo box, I would like the date in “GradYear” field in “tblAssignments” to be filled in automatically with the current “fiscal” year which is found in “tblAnnualDates”. But the date that I need entered is found in the “EventDate” field for the record with “ID” of “10” in that table (“tblAnnualDates”). Does that make any sense?

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts
    Unfortunately it doesn't make enough sense to me to be able to help much. Are you storing the ID for the fiscal year in tblAssignments, or are you wanting to store the year (as an integer presumably)? Also, are you doing this on a form, or in a table?
    Wendell

  3. #3
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,434
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    WsRyan,

    In the Property Sheet for the ComboBox control select the Event Tab.
    In the On Change event click in the box to the right then click on the button
    with the three periods and select Event Procedure.

    Code:
    Private Sub Combo0_Change()
    
      MsgBox "The ComboBox Value has Changed", vbOKOnly, "Combo Box Status:"
      '***Replace with our code to update date***
    
    End Sub
    I hope this points you in the right direction.

    RG
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts
    I woud do this in the AfterUpdate event of the combo box NOT the change event. As far as i know the reason is the change event fires for each keystroke in the combo box.

  5. #5
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    I agree with Patt that it is the After Update event you want to use.

    You could a Dlookup to find the Date you want to use.

    In tblAssignments are you wanting to add a new record, or update an existing record?
    If a new one what else needs to go into the record?
    If an existing one, how do you know which record?
    Regards
    John



  6. #6
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts
    It's not clear to me that he needs any code to do what he is doing. He may well be able to define the RecordSource for the combo box so it looks up the code and stores that in the table - but we need some answers to your quesitons and the ones I posed before that can be determined....
    Wendell

Posting Permissions

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