Results 1 to 2 of 2
  1. #1
    justlearning123 is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jun 2015
    Posts
    17

    is there a way to filter data and copy into excell


    I have a excel workbook and I want it so when I press a command button is pressed a userform comes up and ask what date and shift I want to view the data from and when I hit enter it will look in access and copy only the data with the shift and date selected? thank you

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    My favorite is copyfromrecordset


    untested
    Code:
    Dim xlApp As New Excel.Application
    Dim myBook As Workbook
    Dim mySheet As Worksheet
     
    Set myBook = xlApp.Workbooks.Add
    Set mySheet = myBook.Worksheets(1)
    
    
    dim rs as dao.recordset
    set rs = currentdb.openrecordset("qryname", dbopensnapshot)
    
    mySheet.CopyFromRecordset rs
    
    rs.close
    set rs = nothing
    
    set MySheet = nothing
    
    set mybook = nothing
    mybook.close
    
    set xlApp = nothing

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 03-06-2013, 10:43 AM
  2. Copy Data
    By ahmed.osama in forum Access
    Replies: 5
    Last Post: 08-31-2012, 02:27 PM
  3. Getting values from Excell
    By JeroenMioch in forum Programming
    Replies: 1
    Last Post: 07-13-2012, 08:55 AM
  4. Importing data from Excell
    By paulstu in forum Access
    Replies: 1
    Last Post: 03-31-2012, 06:30 PM
  5. Exporting to excell help
    By stevanb in forum Access
    Replies: 1
    Last Post: 08-23-2011, 01:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums