Runtime Error 424 when embedding MapInfo map in Access form

155 views
Skip to first unread message

MrChimp

unread,
Jul 26, 2011, 10:32:28 AM7/26/11
to MapInfo-L
Hello

I'm kind of new to VB and DAO so please bear with me on this!

I am trying to embed a simple MapInfo map in an Access form based on
the code provided in the MapInfo user guide. It seems I've fallen at
the first hurdle. So far I have this:

Dim mi As Object

Private Sub Form_Open(Cancel As Integer)
Set mi = CreateObject("MapInfo.Application")
MsgBox (mi)
mi.do "Set Application Window " & Form1.Hwnd
mi.do "Set Next Document Parent " & Form1.Hwnd & " Style 1"
mi.do "Open Table ""World"" Interactive Map From World"
mi.RunMenuCommand 1702
mi.do "Create Menu ""MapperShortcut"" ID 17 As ""(-"" "
End Sub

I am getting runtime error 424: "object required" on this line: 'mi.do
"Set Application Window " & Form1.Hwnd'

The MsgBox outputs "MapInfo Professional" which leads me to believe
that the CreateObject command has worked successfully.

However if I comment out the problem line I get the same error on the
next line. Therefore I assume that the mi variable isn't correctly set
up.

Can anybody shed any light on this?

Are there any good resources on line for MapInfo integrated mapping?

Thanks in advance!

Thomas Bacon

unread,
Jul 26, 2011, 11:28:42 AM7/26/11
to mapi...@googlegroups.com
Hi,

I just tested this myself and got the same error. Then I noticed that
under the MS Access Class Objects list (usually top left pane in the
Visual Basic window) my 'Form1' was actually called 'Form_Form1'. Try
using that instead; worked for me!

HTH,

Tom Bacon
Graduate GIS Engineer
Asset Management South
Tel: 01444 472380
www.mouchel.com

Hello

Dim mi As Object

Thanks in advance!

--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en


The information in this e-mail is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorised. Any views or opinions expressed in this e-mail may be solely those of the author and are not necessarily those of Mouchel. Mouchel Limited, Registered in England at Export House, Cawsey Way, Woking, Surrey, UK, GU21 6QX Registered No : 1686040

MrChimp

unread,
Jul 26, 2011, 12:06:26 PM7/26/11
to MapInfo-L
Aha!

One day Access will make sense to me. This is not that day but you
have helped!

Thanks!
> archives, feature requests, to visit our Wiki, visit the Welcome page athttp://groups.google.com/group/mapinfo-l?hl=en
Reply all
Reply to author
Forward
0 new messages