Consulting

Results 1 to 9 of 9

Thread: VBA to pull data from DB

  1. #1

    VBA to pull data from DB

    Hey, I am very new to MS Access, but I am reasonably versed in VBA for Excel. Can someone tell me how I would go about pulling data from a DB to Excel.

    I have to make an invoice up for customers so it will have a Date sold, product, No. Sold, unit price and the total cost.
    So I am trying to pull data from 5 columns in the DB from a specified date to date. Eg, Nov 16th to Dec 15th. On top of that I am trying to pull the previous months invoices grand total in the same fashion, eg, Oct 16th to Nov 15th have that on this months invoice.

    I can do the VBA on the excel side, but I have no clue where to start from the DB side.

    Any help would be appreciated.

  2. #2
    I would recommend doing this with an Access report. This is basic stuff for Access with queries and no VBA code.

    I actual use Access reports to print Excel data. Microsoft recommends this method when you need more powerful reporting than Excel can handle well.
    Boyd Trimmell aka HiTechCoach
    Microsoft Access MVP -2010-2015

    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

  3. #3
    Unfortunately , this is not so simple for me. VBA seems a much easier way to go. BUT, if I were to go via reports, how would I go about doing something like this?

    Cheers

  4. #4
    VBAX Tutor mohanvijay's Avatar
    Joined
    Aug 2010
    Location
    MADURAI
    Posts
    268
    Location
    you can get it by using ADODB Library from Excel VBA

  5. #5
    Quote Originally Posted by JapanDave
    Unfortunately , this is not so simple for me. VBA seems a much easier way to go. BUT, if I were to go via reports, how would I go about doing something like this?

    Cheers
    See if this helps:

    Batch Printing (Access 2000 and later)

    Batch Printing and Save As PDF (Access 2007 and later)

    Cheers.
    Boyd Trimmell aka HiTechCoach
    Microsoft Access MVP -2010-2015

    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

  6. #6
    Thanks guys for the replies. HiTechCoach, that is a great learning tool, I will have to go through it in more depth when I get some more time.

    OK, just one more question about reports. Is it possible to make a reports that have reports within a report. The way I am understanding a report is that you make multiple criteria request to filter out the data you are after. But what happens when you want a whole new set of criteria to to filtered ,but have it on the same report? Can you do that?

    Filter out a set of employees from store location A's sales and on the same report filter out a set of employees from location B's sales?

    I admit I am going to have to research this more in depth myself.

  7. #7
    Here are some ways to handle what you want: Report Dialog Examples
    Boyd Trimmell aka HiTechCoach
    Microsoft Access MVP -2010-2015

    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

  8. #8
    Thanks HiTechCoach. I have not had time ti check them fully out, but thats looks like a lot of work there. Thanks for the link to your file.

    Cheers

    Dave

  9. #9
    Being new to Acess I am sure it looks ike a lot of work but it really is very easy to do.

    Welcome to the world of databes development and creating a User Interace (UI). Excel really do not have a lot of tools for UI stuff like Access does with forms, etc.
    Boyd Trimmell aka HiTechCoach
    Microsoft Access MVP -2010-2015

    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

Posting Permissions

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