andy.mcvicker@siemens.com wrote:[color=blue]
> Hi Gang
>
> I have a large VB program that at one point does a lookup to a small
> table (26 rows by 3 columns). With this table I have to do some
> counting and retrieval of data. I'm finding that this slows the
> program right down.
>
> Is there any way I can take a copy of the table in memory and access it
> there. Perhaps a cursor or something? Can someone help with a code
> sample. Here's my code to do the lookup.
>
> '-------------------------------------------------------------------------------------
> lcFoundCADIMUOM = "False"
> lcPrintUOMNotFound = ""
>
> Set rsUOMCheck = db.OpenRecordset("SELECT cadimuom FROM CADIM_UOM WHERE
> cadimuom = '" & lcUOM & "'")
> If rsUOMCheck.RecordCount <> 0 Then
> lcFoundCADIMUOM = "True"
> End If
>
> If lcFoundCADIMUOM = "False" Then
> Set rsUOMCheck = db.OpenRecordset("SELECT cadimuom FROM CADIM_UOM
> WHERE cadimuomconvert = '" & lcUOM & "'")
> If rsUOMCheck.RecordCount <> 0 Then
> lcFoundCADIMUOM = "True"
> lcUOM = rsUOMCheck("cadimuom")
> End If
> End If
>
> If lcFoundCADIMUOM = "False" Then
> lcPrintUOMNotFound = lcPrintUOMNotFound & lcUOM & Chr(10)
> End If
> '-------------------------------------------------------------------------------------[/color]
For raw speed my money is on:
Loading each individual set of fields into a delimited string and using
the instr() function to search for your target values.