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 / May 2006

Tip: Looking for answers? Try searching our database.

Find value in array

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Vero - 30 May 2006 18:24 GMT
In MSAccess Visual basic I have the following code

Dim myArray as variant
Dim intcount as integer

DO UNTIL rst.eof
   'I print out data here

  'I start to populate my array here,    strFactorNumber are "T1.1", "T1.2"
and so  on so that at the end the array should contain Myarray=("T1.1",
"T1.2", "T1.3", and so on)

  myarray (intcount) = strFactorNumber
  intcount = intcount +1
rst.movenext
loop

what I want to be able to do is to search myarray and find if a value
already exists there.  If the value is found in the array then I would like
to skip it, if the value is not found then I would like to print it. I'm
pretty new to access and I need Major Help.
Vero - 30 May 2006 20:05 GMT
I found that I can get the value by typing

  For i = LBound(myArray) To i = UBound(myArray)
    If myArray(i) = "xxxFri" Then
       msgbox " array found "  & myArray(i)
Else
   msgbox " array not found " & myArray(i)
End If
Next

what I'm having problems with is storing the values in an array.  I have a
dynamic array myarray (intcount) = strFactorNumber but the value is not put
in to the array.  I try to print the value out and it is blank.

the array works if I do type in the value for the array
    myarray(intcount) = "T1.1"
but the array doesn't work for
    (intcount) = strFactorNumber

Do I need quote around it so the array recognizes the value I'm passing in
or what am I missing.  

> In MSAccess Visual basic I have the following code
>
[quoted text clipped - 17 lines]
> to skip it, if the value is not found then I would like to print it. I'm
> pretty new to access and I need Major Help.
 
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.