giving an error while compiling....

Anonymous
04-11-2003, 10:15 AM
Hi,

I am facing an compilation problem error:"Cannot import data because a connection to the database could not be established"

This is the code snippet:

please anyone kindly help me :

1.I am trying to get the one coulmn of records from table and want to map .

plz any other suggestions would be great....
************************************************** *********
Private Sub Form_Load()

Dim MPApp As New MapPoint.Application
Dim objMap As MapPoint.Map
Dim objLoc As MapPoint.Location
Dim szconn As String
Dim oDS As MapPoint.DataSet

Set objMap = MPApp.ActiveMap
MPApp.Visible = True
MPApp.UserControl = True




With MPApp.ActiveMap.DataSets


'Access database with a query
szconn = MPApp.Path & "\Desktop\FirstMap\ED Conference March 2003 expanded.mdb!ZIP"
Set oDS = .ImportData(szconn, , geoCountryUnitedStates, , geoImportAccessQuery)


End With


End Sub


************************************************** ***********

thanks
Munna

Eric Frost
04-11-2003, 10:30 AM
Just some ideas.. do you have access installed on the machine? it might need to be.

Also, check the path (e.g. MsgBox szConn) right before the Set oDS statement.

Eric

Anonymous
06-25-2003, 01:20 PM
The way you have your code; your access database must be found in
the same location as the MPApp.Path.
Also you have subdirectories liste as well
"\Desktop\FirstMap\ED Conference March 2003 expanded.mdb

All of these folder must be under MPApp.Path ( Whatever MPApp.Path location is).

Hope this helps :D

Fer
06-26-2003, 03:11 PM
Sounds like it could be a db location problem. I think Eric's suggestion of printing the path is a good one so that way you'll see exactly where it's looking for the db. You could also try to put your access db in for example C:\ and use the hardcoded path in your app:

szconn = "C:\ED Conference March 2003 expanded.mdb!ZIP"

that way you'll verify if the error arises from an unlocated db or if it's another issue.


Fernando

 
Web mp2kmag.com
mapforums.com