Results 1 to 2 of 2
  1. #1
    iamstupid is offline Novice
    Windows 2K Access 2003
    Join Date
    May 2011
    Posts
    3

    Extract Specific Data from Access

    Hi guys, was wondering from Access , is it possible to just extract specific data only ?

    my codes are as followed:

    Dim rst As DAO.Recordset
    Dim ApXL As Object
    Dim xlWBk As Object
    Dim xlWSh As Object
    Dim fld As DAO.Field
    Dim strPath As String
    Const xlCenter As Long = -4108
    Const xlBottom As Long = -4107


    strPath = "C:\Tests.xls"
    Dim SeriesNo As String

    strTQname = "tblUnderlyingStocks"

    ('SeriesNo = "820"


    'strTQname = "SELECT * FROM tblUnderlyingStocks WHERE Series No = SeriesNo ") <--- but i want something like this

    Dim strSheetName As String
    strSheetName = "Sheet1"

    Set rst = CurrentDb.OpenRecordset(strTQname)
    Set ApXL = CreateObject("Excel.Application")
    Set xlWBk = ApXL.Workbooks.Open(strPath)
    ApXL.Visible = True
    Set xlWSh = xlWBk.Worksheets(strSheetName)

    xlWSh.Range("A1").Select
    For Each fld In rst.Fields
    ApXL.ActiveCell = fld.Name
    ApXL.ActiveCell.Offset(0, 1).Select
    Next
    rst.MoveFirst
    xlWSh.Range("A2").CopyFromRecordset rst

    Thank for the help in advance !

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,967
    The answer is Yes. What is your specific issue - does this code work? Do you have error message, wrong results, no results? Step debug, follow the code, does it do what you want? What is it exactly you are trying to accomplish?

    The query shows a space in Series No that will cause error.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Extract data at end of cell
    By madsc1 in forum Access
    Replies: 2
    Last Post: 03-21-2011, 04:12 PM
  2. Extract Partial Data
    By madsc1 in forum Access
    Replies: 6
    Last Post: 03-16-2011, 03:43 PM
  3. Extract file attachment from email to Access
    By bet in forum Import/Export Data
    Replies: 3
    Last Post: 02-02-2011, 07:35 PM
  4. Extract Text Data
    By tmcrouse in forum Queries
    Replies: 5
    Last Post: 05-25-2010, 11:34 AM
  5. Replies: 3
    Last Post: 05-13-2010, 08:18 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