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
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