Results 1 to 3 of 3

Thread: Database - Why doesn't my Data Control reload data when I set the RecordSource?

Threaded View

  1. #1

    Thread Starter
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Database - Why doesn't my Data Control reload data when I set the RecordSource?

    It is natural to assume that the data for a Data Control will re-load and populate your controls when you change the RecordSource, however this is not the case.

    In addition to setting the RecordSource you also need to tell the Data Control to reload the data, and you may need to tell your controls to update themselves to show the new data too.

    This is how you can tell the Data Control to reload data like this:
    VB Code:
    1. '(change ADODC1 to the name of your data control)
    2. ADODC1.RecordSource = "..(your recordsource text here).."
    3. ADODC1.Recordset.Requery
    4. ADODC1.Refresh

    If you are showing the data in controls (textbox/grid/etc) that do not update after using the above code, you will need to refresh them too, like this:
    VB Code:
    1. ControlName.Refresh
    Last edited by si_the_geek; Jul 21st, 2007 at 01:27 PM. Reason: corrected code formatting

Posting Permissions

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



Click Here to Expand Forum to Full Width