I faced the same problem months ago and finally could get OLE Automation to
work with the kind help of Jolanda Simon [[EMAIL PROTECTED]] .
Hereby an example, based on 2 forms (this seems to be the trick; one form
has no user interface) and one access table (a copy of the MapInfo STATES
table in Access).
Hope this helps
Pierre
<<Form STATES>>
Option Compare Database
Option Explicit
Public MICallBack As Object
Private Sub Command41_Click()
On Error GoTo Err_Command41_Click
MIObject.DO "Select * from States where State_Name =""" & Text45 & """"
MIObject.DO "Run Menu Command 306"
Exit_Command41_Click:
Exit Sub
Err_Command41_Click:
MsgBox Err.Description
Resume Exit_Command41_Click
End Sub
Private Sub Form_Load()
Set MIObject = CreateObject("MapInfo.Application")
MIObject.Visible = True
MIObject.DO "Set Window MapInfo Front"
MIObject.DO "Open Table ""C:\mapinfo\data\usa\States"" Interactive"
MIObject.DO "Map from States"
MIObject.DO "Create ButtonPad ""CallBack"" As ToolButton ID 2000
Drawmode 34 Cursor 138 Calling OLE ""QueryTool"""
Set MICallBack = New Form_FrmclsMapInfo
End Sub
Private Sub Form_Unload(Cancel As Integer)
MIObject.Visible = False
Set MIObject = Nothing
Set MICallBack = Nothing
End Sub
<<<FORM FrmclsMapInfo>>>
Option Compare Database
Option Explicit
Public Sub SetStatusText(ByVal cmd As String)
Form_STATES.Text47 = cmd
End Sub
Private Sub Form_Open(Cancel As Integer)
MIObject.SetCallBack Me
End Sub
Public Sub QueryTool(ByVal cmd As String)
Dim arg(8) As String
Dim start As Integer
Dim length As Integer
Dim ndx As Integer
Dim pos As Integer
Dim Table As String
Dim row As String
Dim count As Integer
Form_STATES.Text49 = cmd
arg(8) = ""
ndx = 1
start = 4
length = Len(cmd)
While (start < length)
pos = InStr(start, cmd, ",")
If (pos = 0) Then
arg(ndx) = Mid$(cmd, start, 32767)
start = length
Else
arg(ndx) = Mid$(cmd, start, pos - start)
start = pos + 1
End If
ndx = ndx + 1
Wend
count = Val(MIObject.Eval("SearchPoint(WindowID(FrontWindow())," & arg(1) &
"," & arg(2) & ")"))
If (count >= 1) Then
Table = MIObject.Eval("SearchInfo(1,1)")
row = MIObject.Eval("SearchInfo(1,2)")
MIObject.DO "Fetch Rec " & row & " From " & Table
Form_STATES.Text49 = MIObject.Eval(Table & ".col1")
Form_STATES.SelTop = MIObject.Eval(Table & ".rowid")
End If
End Sub
> -----Original Message-----
> From: Catherine ABIBON [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, July 06, 2000 2:29 PM
> To: [EMAIL PROTECTED]
> Subject: MI Callbacks with Access
>
> I saw in the messages some of you had problems with callbacks when using
> OLE
> from access. I'd like to know if you have found how to manage with this
> problem and eventually if you have use DDE to contourn this trouble how
> have
> you done it.
>
> My problem is the second line of those doesn't work
> Set myCallBack = New MICallBack
> MapInfo.SetCallback myCallBack
>
> Thank you for all solutions that can let me solve this problem ...
>
> Cathy Abibon BRLi DIh
> tel : 04 66 87 50 00
> fax : 04 66 87 50 59
> mail : [EMAIL PROTECTED]
>
>
>
> ----------------------------------------------------------------------
> To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
> "unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]