PC Review


Reply
Thread Tools Rate Thread

dynamic array help

 
 
Marc
Guest
Posts: n/a
 
      14th Dec 2006
i need to change the below array so that it is dynmanic...how can i do
this?

i.e there wont always be 4 values.

Sub MapSelectedProperties()
Dim objLoc2(1 To 4) As MapPoint.Location
Dim i As Integer
i = 0
Set Recordset = CurrentDb.OpenRecordset("SELECT * FROM
tblProperties;")
If Recordset.RecordCount > 0 Then
While Not Recordset.EOF
i = i + 1
Set objLoc2(i) = objMap.FindAddressResults(Recordset!strStreet,
Recordset!strCity, Recordset!strState, Recordset!strPostalCode)(1)
Set objPin = objMap.AddPushpin(objLoc2(i), Recordset!strStreet)
Recordset.MoveNext
Wend
End If
objMap.Shapes.AddPolyline objLoc2


End Sub

 
Reply With Quote
 
 
 
 
Allen Browne
Guest
Posts: n/a
 
      15th Dec 2006
You an ReDim an array at runtime:

Dim lngHowMany As Long
lngHowMany = Nz(DCount("*", "tblProperties"), 0)
ReDim objLoc2(lngHowMany) As ...

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Marc" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>i need to change the below array so that it is dynmanic...how can i do
> this?
>
> i.e there wont always be 4 values.
>
> Sub MapSelectedProperties()
> Dim objLoc2(1 To 4) As MapPoint.Location
> Dim i As Integer
> i = 0
> Set Recordset = CurrentDb.OpenRecordset("SELECT * FROM
> tblProperties;")
> If Recordset.RecordCount > 0 Then
> While Not Recordset.EOF
> i = i + 1
> Set objLoc2(i) = objMap.FindAddressResults(Recordset!strStreet,
> Recordset!strCity, Recordset!strState, Recordset!strPostalCode)(1)
> Set objPin = objMap.AddPushpin(objLoc2(i), Recordset!strStreet)
> Recordset.MoveNext
> Wend
> End If
> objMap.Shapes.AddPolyline objLoc2
>
>
> End Sub



 
Reply With Quote
 
Marc
Guest
Posts: n/a
 
      15th Dec 2006
Thanks it works now!!!

Allen Browne wrote:
> You an ReDim an array at runtime:
>
> Dim lngHowMany As Long
> lngHowMany = Nz(DCount("*", "tblProperties"), 0)
> ReDim objLoc2(lngHowMany) As ...
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "Marc" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> >i need to change the below array so that it is dynmanic...how can i do
> > this?
> >
> > i.e there wont always be 4 values.
> >
> > Sub MapSelectedProperties()
> > Dim objLoc2(1 To 4) As MapPoint.Location
> > Dim i As Integer
> > i = 0
> > Set Recordset = CurrentDb.OpenRecordset("SELECT * FROM
> > tblProperties;")
> > If Recordset.RecordCount > 0 Then
> > While Not Recordset.EOF
> > i = i + 1
> > Set objLoc2(i) = objMap.FindAddressResults(Recordset!strStreet,
> > Recordset!strCity, Recordset!strState, Recordset!strPostalCode)(1)
> > Set objPin = objMap.AddPushpin(objLoc2(i), Recordset!strStreet)
> > Recordset.MoveNext
> > Wend
> > End If
> > objMap.Shapes.AddPolyline objLoc2
> >
> >
> > End Sub


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Speed of fixed array versus dynamic array Sing Microsoft Excel Programming 8 18th Nov 2007 10:19 AM
Dynamic Array Lbound not working when only one value in array dean.brunne@lion-nathan.com.au Microsoft Excel Programming 3 25th May 2007 04:08 AM
Dynamic array rafaeltini@gmail.com Microsoft Excel Programming 1 5th Feb 2007 10:41 PM
Dynamic 2D Array ExcelMonkey Microsoft Excel Programming 4 31st Jan 2004 09:32 PM
dynamic array of pointers vs dynamic array of objects lemonade Microsoft VC .NET 1 10th Dec 2003 08:31 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:12 PM.