same form uses different datasets

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TBvbaprogrammer
    New Member
    • May 2010
    • 2

    #1

    same form uses different datasets

    I'm looking for vba code to enable within MS Access to have the same form to use different datasets. The requirement is to allow the user to switch between one month to another looking at the same form. The datasets are going to be stored within Access by month. Each passing month will get a new dataset stored to the database. The user while in the form will need to be able to view any month they select.
  • Delerna
    Recognized Expert Top Contributor
    • Jan 2008
    • 1134

    #2
    You don't really need VBA to do that

    However

    in the appropriate event
    [code=sql]
    me.recordsource ="Select theFieldList from theTable where month=selectedm onth"
    me.requery
    me.refresh
    [/code]

    You probably don't need to me.requery
    I put it there to cover all bases

    You will need to provide
    theFieldList
    and theTable
    and selectedmonth

    according to your needs

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32669

      #3
      Storing separate months in separate datasets (I presume you mean tables) is not a good idea (See Normalisation and Table structures).

      The way this should be handled is by applying a simple filter to the opening of the form. Changing the filter can be done in VBA while the form is still open if required. Otherwise, a differnt call to open the form just passes the required filter.

      Comment

      Working...