Results 1 to 13 of 13
  1. #1
    Voodeux2014 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Nov 2014
    Location
    Slidell, LA
    Posts
    130

    Question Updating combobox based on value in a textbox...

    I would like to update 2 separate comboboxes (one has month and one has year) on a form after clicking a button that changes the value of a textbox (displays the current month and year displayed on the calendar form) in order to be able to display appointment data on the form. I am trying to do it this way in order to weave in a calendar program that is designed a little differently than my current design. Is there a way to have a combobox updated after changing the value in the above mentioned textbox?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,956
    What do you mean by 'updated' - refresh the combobox RowSource?

    Me.comboboxname.Requery
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Voodeux2014 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Nov 2014
    Location
    Slidell, LA
    Posts
    130
    One combobox (cboMonth) has information from tblMonth (MonthID and MonthName fields)
    Other combobox (cboYear) is a list selection that has years (2012, 2013, 2014, etc...)

    On the loading of the form the comboboxes go to the current month and year. When clicking the buttons (btnPreviousMonth or btnNextMonth) it updates the text box at the top of the form to display current displayed month/year (e.g. May 2015)

    I would like to have cboMonth and cboYear updated to the displayed month as well.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,956
    Why are they comboboxes? What is purpose of these controls? Why programmatically set value?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Voodeux2014 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Nov 2014
    Location
    Slidell, LA
    Posts
    130
    I am trying to implement the new template into my design. The template requires the comboboxes. My design does not include them. This form is a calendar layout that automatically displays the dates correctly on load and when the buttons are pressed. There is a text box at the top that displays only the current month/year displayed on the calendar. I am trying to get it to the point where i can implement his template and start displaying data on the calendar.

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Hmmm, maybe you can get the index for the items in the RowSource and apply that value to the .Selected property of the combo.

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,956
    I still don't understand what the comboboxes are for. Are they BOUND or UNBOUND.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    Micron is online now Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,818
    Sounds like you are shackled somewhat and are trying to populate an appointment calendar whereas at first I thought there was a calendar control involved. So if the textbox contains only the month and year and a separator like / and is not a date you are faced with a convoluted combination of the Len, Mid and InStr functions to get the date parts on either side of the separator and assign these values to the combo boxes. Yuck! They will not contain date values, so I wonder what good they are to the user because I cannot glean from your posts what is to be done with them. However, if the controls are bound (you do not say how they get their values on form opening) fuggedaboudit!

    But I think the textbox contains a valid date based on what you wrote, so you could extract the values you need using a Date function such as DatePart or DateSerial. Once they are in there, then what? A combo box is for selecting a value from a list and doing something based on the selection, not for populating this way. It makes a bit more sense to me to do what you're doing to text boxes, but then, I don't have a complete understanding of the application.

  9. #9
    Voodeux2014 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Nov 2014
    Location
    Slidell, LA
    Posts
    130
    Quote Originally Posted by Micron View Post
    Sounds like you are shackled somewhat and are trying to populate an appointment calendar whereas at first I thought there was a calendar control involved. So if the textbox contains only the month and year and a separator like / and is not a date you are faced with a convoluted combination of the Len, Mid and InStr functions to get the date parts on either side of the separator and assign these values to the combo boxes. Yuck! They will not contain date values, so I wonder what good they are to the user because I cannot glean from your posts what is to be done with them. However, if the controls are bound (you do not say how they get their values on form opening) fuggedaboudit!

    But I think the textbox contains a valid date based on what you wrote, so you could extract the values you need using a Date function such as DatePart or DateSerial. Once they are in there, then what? A combo box is for selecting a value from a list and doing something based on the selection, not for populating this way. It makes a bit more sense to me to do what you're doing to text boxes, but then, I don't have a complete understanding of the application.

    You are correct in that it is an appointment calendar. The text box at the top is fairly simple. The control source is =[FirstDate] . I have the format on the properties sheet set to mmmm yy in order to display only the month and year in the text box.

    I am trying to get it to where I can display information on the calendar and have it placed in the right locations. I am using the template that is shown in this series of videos. https://www.youtube.com/watch?v=tRyA...uv0RnPcSXz7oHd

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,956
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #11
    Voodeux2014 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Nov 2014
    Location
    Slidell, LA
    Posts
    130
    Thanks june. That is where I got my initial design for what I have now. The only template I see branched off of that requires payment to use. Which I can understand as it takes a ton of work to figure it out, but my company will not pay for it, nor do I want to come out of pocket for it.

  12. #12
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,956
    So did you download the example by rpeare in post 10 of that referenced thread? Does not meet your requirements? Sorry, I can't view YouTube.

    I have seen a free (or maybe it was a demo) appointment db that managed scheduling by half-hour periods. I remember it was very complicated. Finding it again is likely hopeless.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  13. #13
    Micron is online now Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,818
    I looked at the first video for the link you posted and can't relate what I saw to what you say you want to do. At no time did I see the demonstrator programmatically change what's shown in a combo box. Anyway, I guess you have two choices - make it unbound and no value list and set its value in code (me.cmbMonth)="something", or if it has a value list, you can set it to an actual value in the list or refer to it by its index. Setting the value of a combo box makes no sense to me. Whatever value you put in there could be passed to whatever is looking at it instead. If that's nothing, then maybe you should be setting the value of a text box or label. You are supposed to pick what gets displayed in combos by using their list contents to effect changes or supply information, not progammatically alter them.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Updating textbox - combobox per record
    By vincentsp in forum Forms
    Replies: 4
    Last Post: 02-18-2015, 08:09 AM
  2. Replies: 3
    Last Post: 11-05-2014, 02:43 AM
  3. Value of TextBox based on ComboBox
    By John V in forum Forms
    Replies: 13
    Last Post: 07-12-2014, 12:06 PM
  4. Replies: 3
    Last Post: 04-14-2014, 05:50 AM
  5. Updating record based on textbox entry
    By timmy in forum Programming
    Replies: 16
    Last Post: 04-06-2011, 12:05 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums