Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / October 2007

Tip: Looking for answers? Try searching our database.

Split function

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Wavequation - 31 Oct 2007 19:24 GMT
I am using the split function to load an array with substrings from a string.
The array does not have a declared dimension. Can I find out how many
substrings have been loaded?
John Spencer - 31 Oct 2007 19:45 GMT
Try the Lbound and Ubound functions.

UBound(SomeArray) will return the upper boundary of the array.   LBound
returns the lower boundary of the array.
If you want to be absolutely sure of the number of elements, you can
subtract LBound From Ubound and add 1 to get the number of elements in the
array.

Normally Arrays are Zero-based, but they can be one-based.

Signature

John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
.

>I am using the split function to load an array with substrings from a
>string.
> The array does not have a declared dimension. Can I find out how many
> substrings have been loaded?
Douglas J. Steele - 31 Oct 2007 19:47 GMT
The UBound function will give you the largest allowable value for the
dimension, while the LBound function will give you the lowest allowable
value. The number of elements in array MyArray would be UBound(MyArray) -
LBound(MyArray) + 1

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

>I am using the split function to load an array with substrings from a
>string.
> The array does not have a declared dimension. Can I find out how many
> substrings have been loaded?
fredg - 31 Oct 2007 19:49 GMT
> I am using the split function to load an array with substrings from a string.
>  The array does not have a declared dimension. Can I find out how many
> substrings have been loaded?

Look up the UBound function in VBA help.
Arrays are 0 based so you would use
MsgBox UBound(ArrayName) + 1

A string like "Black,Red,Green,Blue"
using the comma as separator, will return an array value of 4.

Signature

Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.