Results 1 to 7 of 7
  1. #1
    willmafingerdo is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2016
    Posts
    108

    using query to populate combo box but wont update

    I am trying to set up my report where i can pick a date on my form and based off that the next combo box will query all codes that match that date. below is the query criteria for pulling the codes. When i an in the query itself it works, but when i run it from my form it does not refresh when i change the date field. is there a refresh or something i need to do??

    Click image for larger version. 

Name:	exmaple.png 
Views:	10 
Size:	8.8 KB 
ID:	46800



    Attached Thumbnails Attached Thumbnails exmaple.jpg  

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,800
    When a value changes in a control, the control that relies on that value needs to be requeried. You could use the after update event of the 1st control to requery the dependent control. You could also do it at the form level using requery, recalc or refresh methods, but that would affect the whole form and might cause issues. So try using the after update event of the 1st control.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    willmafingerdo is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2016
    Posts
    108
    Micron,
    Thanks, that fixed it. I was trying to do the refresh on the 2nd control. That seems to be working now!! ty!!

  4. #4
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,800
    You're welcome!
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Just as a side note I always refresh a control that is dependent on other control(s) or an external parameter(s) in its own GotFocus or Enter event; it saves me adding the requery line to all the other control AfterUpdate events.

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  6. #6
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,800
    I'm not following. You're adding a requery to an event (e.g. gotFocus) for every calculated control? How is that saving any coding? Isn't it still a 1 for 1 thing?
    Or are you saying you're doing 2 or more different afterUpdate events that requery the same one dependent control?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  7. #7
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Yes, it is still 1 to 1 in most cases but sometimes a combo depends on an "external" parameter such as a global variable or tempvar being changed in another place, so doing it just as you enter the control would catch all of those; and sometimes the calculated control depends on more than one other control so instead of adding the requery in each of the afterupdate events for all those controls I add it to the target control itself.
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

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

Similar Threads

  1. Table wont update from query
    By EDOx16 in forum Programming
    Replies: 26
    Last Post: 03-24-2021, 01:34 PM
  2. Table wont update for my form
    By Toaster in forum Forms
    Replies: 3
    Last Post: 11-16-2020, 03:15 PM
  3. Replies: 4
    Last Post: 07-20-2017, 06:07 AM
  4. Query Update/Select Query (Wont Update)
    By NickWren in forum Access
    Replies: 1
    Last Post: 03-30-2016, 10:41 AM
  5. Query and subquery wont work with combo box
    By jbg8931 in forum Queries
    Replies: 0
    Last Post: 05-09-2010, 10:24 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