Results 1 to 2 of 2

Thread: MS Access, SQL and VBa

  1. #1
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default MS Access, SQL and VBa

    Hello List

    Do any of you have a module that will read a specified MS Access database using a provided SQL statement?

    Peter Jamtgaard

  2. #2
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default Re: MS Access, SQL and VBa

    Nevermind, I answered my own question
    Something like this

    Peter Jamtgaard


    Option Explicit
    Public Sub Main()
    RunSQL "c:/acad/lisp/aiscdatabase.mdb", "SELECT TYPE FROM Sheet1 WHERE _ AISC_MANUAL_LABEL = 'W8X10'"
    End Sub
    Public Function RunSQL(ByVal strDataBase, strSQL As String)
    Dim DB As Database
    Dim RS As RecordSet
    Dim intCount As Integer
    Set DB = DBEngine.OpenDatabase(strDataBase)
    Set RS = DB.OpenRecordset(strSQL, dbOpenSnapshot)
    If Not RS.EOF Then
    For intCount = 0 To (RS.Fields.Count - 1)
    MsgBox RS.Fields.Item(intCount).Name & " = " & RS(intCount)
    Next intCount
    End If
    RS.Close
    DB.Close
    End Function

Similar Threads

  1. RPC Access
    By vanderloo5 in forum Revit - Platform
    Replies: 2
    Last Post: 2008-12-07, 01:15 AM
  2. quick access - no access
    By CADMama in forum AutoCAD General
    Replies: 5
    Last Post: 2008-09-11, 08:49 PM
  3. VAV box access
    By clarkmorgan in forum Parts Builder
    Replies: 3
    Last Post: 2008-05-09, 06:37 PM
  4. Access
    By Guy F Lapouble in forum AutoLISP
    Replies: 3
    Last Post: 2007-06-22, 10:00 PM
  5. Access vs. SQL
    By bhargis in forum VBA/COM Interop
    Replies: 4
    Last Post: 2004-12-09, 11:08 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
  •