Message 1 of 5
Drawing from an Access database

Not applicable
11-30-1999
07:33 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Has anyone ever tried to read from an Access Database much like you
would from an Excel spreadsheet? What I am trying to do I can now do
from Excel, but would like to pull from the source. The goal is to
read position data about objects into a drawing file and insert a block
at the position that is recorded in the database. Please forgive my
ignorance, I haven't given much effort to this yet, but am doing a
little bit of research first. Here is the code that I have been using
from Excel, this example just draws lines.
Thanks,
Rob
' Allows the user to establish a starting point for the lines to be
drawn
objStartPoint = ThisDrawing.Utility.GetPoint(, vbCr & " Pick a point
to start from: ")
' Determines the ROW to start on
RowNum = 2
' Excel file linkning and opening
Set ExcelApp = CreateObject("Excel.Application")
ExcelApp.Workbooks.Open
FileName:="D:\MFVR\Year_Two\Collection_Verification\test.xls"
Set ExcelDoc = ExcelApp.ActiveWorkbook
Set ExcelSheet = ExcelDoc.ActiveSheet
While ExcelSheet.cells(RowNum, 2).Value <> ""
varDirection = Trim(ExcelSheet.cells(RowNum, 2).Value)
dblDirection = ThisDrawing.Utility.AngleToReal(varDirection,
acDegrees)
varDistance = Trim(ExcelSheet.cells(RowNum, 3).Value)
objPolarPoint =
ThisDrawing.Utility.PolarPoint(objStartPoint, dblDirection, varDistance)
Set objLine = ThisDrawing.ModelSpace.AddLine(objStartPoint,
objPolarPoint)
objStartPoint = objPolarPoint
RowNum = RowNum + 1
Wend
ZoomExtents
ExcelApp.Application.Quit
----------------------------------------
Robert B. Brown
Lead Visualization Specialist
703.923.4496
----------------------------------------
Autometric Inc.
http://www.autometric.com
would from an Excel spreadsheet? What I am trying to do I can now do
from Excel, but would like to pull from the source. The goal is to
read position data about objects into a drawing file and insert a block
at the position that is recorded in the database. Please forgive my
ignorance, I haven't given much effort to this yet, but am doing a
little bit of research first. Here is the code that I have been using
from Excel, this example just draws lines.
Thanks,
Rob
' Allows the user to establish a starting point for the lines to be
drawn
objStartPoint = ThisDrawing.Utility.GetPoint(, vbCr & " Pick a point
to start from: ")
' Determines the ROW to start on
RowNum = 2
' Excel file linkning and opening
Set ExcelApp = CreateObject("Excel.Application")
ExcelApp.Workbooks.Open
FileName:="D:\MFVR\Year_Two\Collection_Verification\test.xls"
Set ExcelDoc = ExcelApp.ActiveWorkbook
Set ExcelSheet = ExcelDoc.ActiveSheet
While ExcelSheet.cells(RowNum, 2).Value <> ""
varDirection = Trim(ExcelSheet.cells(RowNum, 2).Value)
dblDirection = ThisDrawing.Utility.AngleToReal(varDirection,
acDegrees)
varDistance = Trim(ExcelSheet.cells(RowNum, 3).Value)
objPolarPoint =
ThisDrawing.Utility.PolarPoint(objStartPoint, dblDirection, varDistance)
Set objLine = ThisDrawing.ModelSpace.AddLine(objStartPoint,
objPolarPoint)
objStartPoint = objPolarPoint
RowNum = RowNum + 1
Wend
ZoomExtents
ExcelApp.Application.Quit
----------------------------------------
Robert B. Brown
Lead Visualization Specialist
703.923.4496
----------------------------------------
Autometric Inc.
http://www.autometric.com