• using recordset from filtered form- access 2007

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » using recordset from filtered form- access 2007

    • This topic has 2 replies, 2 voices, and was last updated 16 years ago.
    Author
    Topic
    #459514

    If I use the filtering options on a continous form, can I then use the recordsetclone to get only those records and then save them as a table or send them to word or excel, as the basis for a mailmerge? If someone has code for this, great, otherwise I will try to create it.
    Thanks

    Viewing 1 reply thread
    Author
    Replies
    • #1158803

      You could use code like this:

      Code:
      Dim strSQL As String
      If Me.FilterOn = True Then
        strSQL = "SELECT * INTO tblNew FROM tblOld WHERE " & Me.Filter
        CurrentDb.Execute strSQL
      End If

      Here, tblNew is the name of the table to be created, and tblOld is the name of the table (or query) that acts as record source for the form.

      In the above, I assumed that the code is in the form’s own module. If it’s not, you must replace both occurrences of Me with a reference to the form, e.g. Forms!frmTest.

    • #1158829

      Brilliant. A lot easier than reacordset clone.
      Thanks as usual

    Viewing 1 reply thread
    Reply To: using recordset from filtered form- access 2007

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: