Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Nov 2004
    Location
    Lexington Park, Maryland, USA
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Reassigning Form Recordsource (Access 2000)

    I have a subform that has a recordsource previously assigned to it. I now want to reassign the recordsource of that subform. I am simply using the following code. I used this exact code to first assign the recordsource and works perfectly. Is there something I need to do before or after this bit of code to make it work?


    dim i as integer
    dim strRecordSource(1 to 14) as string
    dim intDataSetOn

    intDataSetOn = 2

    For i = 1 To 14
    strRcrdSource(i) = "SELECT * FROM Saved_Data_" & i & " WHERE Data_Set_Number = " & intDataSetOn
    Next i

    Me.Configuration_Subform.Form.RecordSource = strRcrdSource(1)
    Me.Dimensions_Engines_Subform.Form.RecordSource = strRcrdSource(2)
    Me.Dimensions_Equipment_Subform.Form.RecordSource = strRcrdSource(3)
    Me.Dimensions_Fuselage_Subform.Form.RecordSource = strRcrdSource(4)
    Me.Dimensions_Landing_Gear_Subform.Form.RecordSour ce = strRcrdSource(5)
    Me.Dimensions_Main_Rotor_Subform.Form.RecordSource = strRcrdSource(6)
    Me.Dimensions_Tail_Subform.Form.RecordSource = strRcrdSource(7)
    Me.Dimensions_Tail_Rotor_Subform.Form.RecordSource = strRcrdSource(8)
    Me.Dimensions_Wing_Subform.Form.RecordSource = strRcrdSource(9)
    Me.Performance_Subform.Form.RecordSource = strRcrdSource(10)
    Me.Weights_Equipment_Subform.Form.RecordSource = strRcrdSource(11)
    Me.Weights_General_Subform.Form.RecordSource = strRcrdSource(12)
    Me.Weights_Propulsion_Subform.Form.RecordSource = strRcrdSource(13)
    Me.Weights_Structure_Subform.Form.RecordSource = strRcrdSource(14)

    me.refresh

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Reassigning Form Recordsource (Access 2000)

    This kind of thing usually works without additional code, but you might try Requery instead of Refresh, and if necessary Requery all subforms.

    (Refresh only checks if records have been modified by other users, it assumes that the record source itself hasn't changed. Requery reads the record source anew)

  3. #3
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Reassigning Form Recordsource (Access 2000)

    What exactly is it doing (or not doing)? Any error messages?
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

Posting Permissions

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