Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 271639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T00:11:46+00:00 2026-05-12T00:11:46+00:00

Hey I just sort of learned how to put my SQL statements into VBA

  • 0

Hey I just sort of learned how to put my SQL statements into VBA (or atleast write them out), but I have no idea how to get the data returned?

I have a couple forms (chart forms) based on queries that i run pretty regular parameters against, just altering timeframe (like top 10 sales for the month kinda of thing). Then I have procedures that automatically transport the chart object into a powerpoint presentation. So I have all these queries pre-built (like 63), and the chart forms to match (uh, yeah….63…i know this is bad), and then all these things set up on “open/close” events triggering the next (its like my very best attempt at being a hack….or dominos; whichever you prefer).

So I was trying to learn how to use SQL statements in VBA, so that eventually I can do all this in there (I may still need to keep all those chart forms but I don’t know because I obviously lack understanding).

So aside from the question that I asked at the top, can anyone offer advice?
thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T00:11:47+00:00Added an answer on May 12, 2026 at 12:11 am

    It’s a bit dated, so you might want to grab a book on the subject. But, here’s a ton of access resources and some tutorials and examples as well. But, basically …

    Dim dbs As Database
    Dim rs As Recordset
    Dim strSQL As String
    Set dbs = CurrentDb
    
    strSQL = 'your query here
    
    Set rs = dbs.OpenRecordset(strSQL)
    
    If Not (rs.EOF And rs.BOF) Then
      rs.MoveFirst
      'get results using rs.Fields()
    Else
    
    'Use results
    

    Per comment: Take a look at the recordset class. It contains a collection called Fields that are the columns that are returned from your query. Without knowing your schema, it’s hard to say, but something like …

    rs.MoveFirst
    Do While Not rs.EOF
       'do something like rs("SomeFieldName") 
       rs.MoveNext
    Loop
    

    Like I said, your best bet is to grab a book on this subject, they have tons of examples.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey just a quick question for any experts out there. I have a site
Hey everyone, just a quick thing, I have the hex to integer working, but
Hey - just starting out trying to get some openGL into my iphone app
Hey just wondering how I can draw multiple rectangle objects in C# but have
Hey i'm just trying to write some code in DrScheme: ((function (x) (* x
Hey gang. I have just written a client and server in C++ using sys/socket.
Hey I'm just learning C in school and I have this idea for a
Hey I just wrote a Hello World code for ASP. But it is not
Hey I just wanted to find out the working of the following script as
Hey I was just wondering if there is a cool one liner that would

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.