PDA

View Full Version : Balloon Confusion



plevine1
10-20-2006, 12:03 PM
I am mapping a few locations and I only want to display the pushpin.note. The location balloon also displays the address. Any help would be great. I am using the following code:


Sub MapSelectedProperties()
'Map the selected properties
On Error GoTo MapSelectedProperties_Err_Exit
Dim db As Database
Dim rstProps As Recordset

Dim objLoc As MapPoint.Location
Dim objMap As MapPoint.Map
Dim objPushpin As MapPoint.Pushpin

Dim strMsg As String
Dim i As Integer
i = 0
Set db = CurrentDb()

'Load the selected properties into a recordset
Set rstProps = db.OpenRecordset("SELECT * FROM tblProperties WHERE ysnSelected = Yes;")
'Make sure at least one property was selected
If rstProps.RecordCount > 0 Then
'Load Map
If LoadMap() Then
'Open the form containing the map
FormOpen "frmMap"
Set objMap = gappMP.ActiveMap
'Place a pushpin on the map for each selected property
While Not rstProps.EOF
i = i + 1
Set objLoc = objMap.FindAddressResults(rstProps!strStreet, rstProps!strCity, rstProps!strState, rstProps!strPostalCode)(1)
Set objPushpin = objMap.AddPushpin(objLoc, rstProps!strStreet)
objPushpin.Name = CStr(i)
objPushpin.Note = rstProps!curListPrice & " " & "Total Machines: " & rstProps!machinecount
objPushpin.BalloonState = geoDisplayBalloon
objPushpin.Symbol = 4
objPushpin.Highlight = True
rstProps.MoveNext
Wend
'Show all pushpins on the map display
objMap.DataSets.ZoomTo
Else
strMsg = "Unable to load map."
MsgBox strMsg, vbOKOnly + vbExclamation, APP_NAME
End If
Else
strMsg = "No properties selected."
MsgBox strMsg, vbOKOnly + vbExclamation, APP_NAME
End If
MapSelectedProperties_Err_Exit:
On Error Resume Next
Set objPushpin = Nothing
Set objLoc = Nothing
Set objMap = Nothing
rstProps.Close
db.Close
Exit Sub
MapSelectedProperties_Err:
Resume MapSelectedProperties_Err_Exit
End Sub

Wilfried
10-21-2006, 01:34 PM
Hi,

I'm not sure if I understeand what you ask. The display balloon displays the string you assign to it, no more and no less. So you loop trough a table and assign pushpin name and notes. That's what is displayed

If I understeand wrong please explain again :)

plevine1
10-21-2006, 05:55 PM
I didnt write the code I included but copied it from an existing program. The code works fine. The balloon currently displays the address, city and state. It also displays the note. I only want the note displayed and don't know which line of the code to remove.

Wilfried
10-22-2006, 01:01 PM
Hi,


While Not rstProps.EOF
i = i + 1
Set objLoc = objMap.FindAddressResults(rstProps!strStreet, rstProps!strCity, rstProps!strState, rstProps!strPostalCode)(1)
Set objPushpin = objMap.AddPushpin(objLoc, rstProps!strStreet)
objPushpin.Name = CStr(i)
objPushpin.Note = rstProps!curListPrice & " " & "Total Machines: " & rstProps!machinecount

You loop here in a table. The last line is assigning different things to the pushpin's note. If you comment it then the note is empty, or change it so that it only contains the fields of the table you wants.

plevine1
10-22-2006, 01:28 PM
Thanks but I'm still confused. The note is what I want. I dont want to display the address. If I comment out the note then just the address will show in the balloon.

Wilfried
10-24-2006, 04:17 AM
Hi,

Probably the name of the pushpin is the address. Your code does not show what is assigned to CStr. Comment out next line:

objPushpin.Name = CStr(i)
But I'm not sure you can have multiple pushpins with same name (or no name). But you can try.

plevine1
10-24-2006, 12:12 PM
Maybe the attached picture will explain my problem.

Wilfried
10-24-2006, 01:15 PM
Hi,

Where is the attachment ?