Consulting

Results 1 to 6 of 6

Thread: VBA & Get Select Result in visio

  1. #1

    Exclamation VBA & Get Select Result in visio


    Hi , I work with VBA in visio , and i conected to my Instance in sql sever 2005
    ,and now i want execute Select query and get the result of this query from one of my table.
    i dont know how can i retrive the result of this qury without datatabel, database , and qureyDef

    i cant define DAO.Database , QueryDef ,...

    i use below code to conect database


    Const DB_CONNECT_STRING = "Provider=SQLOLEDB.1;Data Source=unicorn-pc\mssqlserver2005;Initial Catalog=EEPDC;user id ='sa';password='12345'"

    Set MyConn = CreateObject("ADODB.Connection")

    Set myCommand = CreateObject("ADODB.Command")

    MyConn.Open DB_CONNECT_STRING

    Set myCommand.ActiveConnection = MyConn

    myCommand.CommandText = "select RevisionID from dbo.Revision where ObjectID_FK=1 "



    myCommand.Execute

    MyConn.Close

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,443
    Location
    Hi unicorn4007,

    What exactly is the problem that you are having? Is it getting the data from SQL Server, using it in Visio, or what?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Hi Xld
    in C# when we want access to data , after select it from Database , we store data in DataTable and we can use it .( use dataadapter and datatabel)
    in VBA Programing in visio , i dont have this object , i want to know how can i get this data.
    i want show this data in lables that i insert in my page .

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,443
    Location
    Using DAO and ADO you can query the SQL SEerver database and it returns a recordset. This consists of Fields (column names) and items (data rows). This should get you what you want.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    Hihow can i used DAO ? how can i add this to my progect ?i cant define DAO.database or Querydef ?do i need to add somthing to my project for DAO ?

  6. #6

    Lightbulb

    thanks , i found how can i solve this problem


    Quote Originally Posted by unicorn4007
    Hihow can i used DAO ? how can i add this to my progect ?i cant define DAO.database or Querydef ?do i need to add somthing to my project for DAO ?

Posting Permissions

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