PC Review


Reply
Thread Tools Rate Thread

Displaying the results of a Search

 
 
mgallagjr@gmail.com
Guest
Posts: n/a
 
      6th Aug 2007
I have built a function that will find every instance of a record, and
then store those records in an array. What I would like to do is have
that information displayed in a window so that all the information
matching that record is displayed. I am relatively new to VBA and do
not know if this is even possible.

Here is the code that finds my records and sets them in the array:

Public Function BadgeSearch(myTXT As String, myCol As String, mycoL2
As String, myfiLler As Object)
'Searches for variable info that is provided by userform in the Master
List worksheet and returns the row value for updating

Badge = myTXT
Myrec = 3
myfiLler.Clear
ReDim myVal(0 To 0) As Integer
ReDim Myval2(0 To 0) As Integer
counTer = 0
Do Until Range(myCol & CStr(Myrec)).Text = ""
Do While (Range(myCol & CStr(Myrec)).Text = Badge)
If Range(myCol & CStr(Myrec)).Text = Badge Then
myfiLler.AddItem (Range(mycoL2 & Myrec).Value)
Myval2 = myVal
ReDim myVal(0 To counTer) As Integer
For z = 0 To UBound(Myval2)
myVal(z) = Myval2(z)
Next z
ReDim Myval2(0 To counTer)
myVal(counTer) = Myrec
counTer = counTer + 1
End If
Myrec = Myrec + 1
If Range(myCol & CStr(Myrec)).Text = "" Then
Exit Do
End If
Loop
Myrec = Myrec + 1
Loop
End Function

 
Reply With Quote
 
 
 
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      6th Aug 2007
Define Window

Anyway:

Public Function BadgeSearch(myTXT As String, myCol As String, mycoL2
As String, myfiLler As Object)
'Searches for variable info that is provided by userform in the Master
List worksheet and returns the row value for updating

Dim s as String, i as Long
Badge = myTXT
Myrec = 3
myfiLler.Clear
ReDim myVal(0 to 0) As Integer

counTer = 0
Do Until Range(myCol & CStr(Myrec)).Text = ""
Do While Range(myCol & CStr(Myrec)).Text = Badge
If Range(myCol & CStr(Myrec)).Text = Badge Then
myfiLler.AddItem Range(mycoL2 & Myrec).Value
myVal(counTer) = Myrec
counTer = counTer + 1
Redim Preserve myVal(0 to counTer)
End If
Myrec = Myrec + 1
If Range(myCol & CStr(Myrec)).Text = "" Then
Exit Do
End If
Loop
Myrec = Myrec + 1
Loop
if ubound(myval,1) <> 0 then
redim preserve myval(0 to ubound(myval,1) - 1)
end if
s = ""
for i = lbound(myval,1) to ubound(myval,1)
s = s & myval(i) & vbNewLine
Next
msgbox s
End Function

Modifications Untested.

--
Regards,
Tom Ogilvy

"(E-Mail Removed)" wrote:

> I have built a function that will find every instance of a record, and
> then store those records in an array. What I would like to do is have
> that information displayed in a window so that all the information
> matching that record is displayed. I am relatively new to VBA and do
> not know if this is even possible.
>
> Here is the code that finds my records and sets them in the array:
>
> Public Function BadgeSearch(myTXT As String, myCol As String, mycoL2
> As String, myfiLler As Object)
> 'Searches for variable info that is provided by userform in the Master
> List worksheet and returns the row value for updating
>
> Badge = myTXT
> Myrec = 3
> myfiLler.Clear
> ReDim myVal(0 To 0) As Integer
> ReDim Myval2(0 To 0) As Integer
> counTer = 0
> Do Until Range(myCol & CStr(Myrec)).Text = ""
> Do While (Range(myCol & CStr(Myrec)).Text = Badge)
> If Range(myCol & CStr(Myrec)).Text = Badge Then
> myfiLler.AddItem (Range(mycoL2 & Myrec).Value)
> Myval2 = myVal
> ReDim myVal(0 To counTer) As Integer
> For z = 0 To UBound(Myval2)
> myVal(z) = Myval2(z)
> Next z
> ReDim Myval2(0 To counTer)
> myVal(counTer) = Myrec
> counTer = counTer + 1
> End If
> Myrec = Myrec + 1
> If Range(myCol & CStr(Myrec)).Text = "" Then
> Exit Do
> End If
> Loop
> Myrec = Myrec + 1
> Loop
> End Function
>
>

 
Reply With Quote
 
mgallagjr@gmail.com
Guest
Posts: n/a
 
      9th Aug 2007
On Aug 6, 4:10 pm, Tom Ogilvy <TomOgi...@discussions.microsoft.com>
wrote:
> Define Window



What I am looking to do is take that search function, then take the
row references that are stored in the array and display the data that
is in the first 8 columns at each row returned to the array and
display that info all in one userform would probably be a better
description than a window.

 
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
Displaying Results From A Search Query =?Utf-8?B?QmFybmll?= Microsoft Access Queries 1 19th Oct 2005 01:53 PM
Displaying search query results on a form =?Utf-8?B?QmFybmll?= Microsoft Access 2 11th Aug 2005 03:11 PM
displaying search results form =?Utf-8?B?VG9ueQ==?= Microsoft Access Forms 1 9th Mar 2005 08:47 AM
Displaying results of a search Jim Windows XP Internet Explorer 1 17th Dec 2003 02:00 PM
Displaying the Results of Search Query NIcole Microsoft Access Queries 1 11th Dec 2003 07:53 PM


Features
 

Advertising
 

Newsgroups
 


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