Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

selecting MText and using in Access database 1

Status
Not open for further replies.

jsfrisbee

Programmer
Nov 28, 2005
1
0
0
US
I am new to AutoCAD but pretty good in Access - I need to select an MText in AutoCAD and put the text string in a textbox in Access and I guess I can't quite get the code right...here is what I have so far:


Public dbsObj As Access.Application
Public frmObj As Access.Form
Option Explicit

Private Sub CommandButton1_Click()
Dim sset As AcadSelectionSet
Dim entObj As AcadMText

On Error Resume Next
sset("handler").Delete
Set sset = ThisDrawing.SelectionSets.Add("handler")
UserForm1.Hide
sset.SelectOnScreen
Set entObj = sset.Item(0)

Set dbsObj = GetObject("C:\Newburgh\NewburgData.mdb")
dbsObj.Visible = True
Set frmObj = Forms!Switchboard
' need to open form but not sure of syntax
frmObj!txtHazMatID = entObj.TextString

End Sub

This skips the selecting process and just opens the database - I assume my error handling step is wrong but can't figure out how to fix it. Does anyone see what I am missing? Thanks for any help.
Jenn
 
Hi Jenn,

Yep, your error handler is the problem. The line:
Code:
sset("handler").Delete

will return an error if no such selection exists. Take a look at FAQ687-5792. The part you're interested in is the vbdPowerSet routine. That will handle querying the drawing for an existing selection set and handle it.

HTH
Todd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top