Visio and Access

J

JoanaChang

How can I read a especific data (and cell) from a query table of a
access document. from Visio??

Thanks
 
J

JuneTheSecond

Visio has data impot wizard in menu tool, addons.
How would you like to try it.
 
J

JoanaChang

I have this code now, the sql comand (source) makes a query with som
parameters,
but how can I do for read a specific cell of an access table withou
pass it to an excel file?



Sub ConsultaDePrueba()
Dim strAngle As String
Dim rsTest As ADODB.Recordset
Dim cnTest As ADODB.Connection
Dim tabNueva As TableDef
Dim rowNuevo As Row
Dim fila As Integer

Dim appexcel As Excel.Application
Dim xlbook As Excel.Workbook
Dim xlsheet As Excel.Worksheet
Dim visDocument As Visio.Document
Dim NombreHoja As String
'On Error Resume Next 'no le para a los errores
Set visDocument = ActiveDocument
Set appexcel = CreateObject("excel.application")
appexcel.Visible = True
Filename = visDocument.Path + "Base1" 'NOMBRE DEL ARCHIV
EXCEL
NombreHoja = "hoja3"
appexcel.Workbooks.Open (Filename)
Set H1 = appexcel.Worksheets(NombreHoja)

Set cnTest = New ADODB.Connection
cnTest.Provider = "microsoft.jet.oledb.4.0"
cnTest.ConnectionString = "primerpaso.mdb" 'siempre busca en e
mismo directorio que se encuentra este proyecto
cnTest.Open

Set rsTest = New ADODB.Recordset
rsTest.ActiveConnection = cnTest
rsTest.Source = "select * from paso1 where angle = cint(5)"
'ojo solo acepta string en caso de usar numero convertir !
rsTest.CursorType = adOpenStatic
rsTest.LockType = adLockOptimistic
rsTest.Open

fila = 2
Do While Not rsTest.EOF = True
H1.Cells(fila, 1).Value = rsTest.Fields("angle")
'H1.Cells(2, 1).Value = rsTest.Fields("angle")
rsTest.MoveNext
fila = fila + 1
Loop

H1.Cells.EntireColumn.AutoFit 'para autoajustar el tamano de la
columnas

End Su
 
A

Al Edlund

what I do is create the query in access so that I get the correct
information, and then use the view => sql in the query panel to get the sql
call. I can then paste that into the visio code as a template.
al
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top