Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jan 2002
    Location
    Delta, Br. Columbia
    Posts
    116
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Changing the Record Source property (Access 2000/XP)

    I have a form and subform. The main form allows the user to select what they want to see in the subform It is done using a query with multiple uses of IIF(). My problem is that one of the choices the user wants to see is the choice between the Latest Revision of the Job Datasheets or All Revisions of the Job Datasheets. I have created a combo box to change the RecordSource of the subform, and then inserted the following code, which selects from the 2 different queries to execute:

    Private Sub ComboRevisions_AfterUpdate()
    If Me!ComboRevisions = "Latest Revision" Then
    Forms!frmDatasheets_List!frmDatasheets_List_Subfor m.RecordSource = "qryDatasheet_Select"
    Else
    Forms!frmDatasheets_List!frmDatasheets_List_Subfor m.RecordSource = "qryDatasheet_Select_AllRevisions"
    End If

    Me!frmDatasheets_List_Subform.Requery
    End Sub

    This is not working as I get the error "Runtime error 438 - Object doesn't support this property or method." I understand (sort of) what this means but I am now stuck with how I achieve my goal.

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Changing the Record Source property (Access 2000/XP)

    You need to go a bit further:

    Forms!frmDatasheets_List!frmDatasheets_List_Subfor m.Form.RecordSource = "qryDatasheet_Select"

    The subform control doesn't have a recordsource. You have to address the form object that populates it.
    Charlotte

  3. #3
    2 Star Lounger
    Join Date
    Jan 2002
    Location
    Delta, Br. Columbia
    Posts
    116
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Changing the Record Source property (Access 2000/XP)

    Thank you very much - that now works perfectly

Posting Permissions

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