Doing a query on some portion of a text field 
Author Message
 Doing a query on some portion of a text field

Hi, I'm doing a database program using VB3/Access2 and have
come across some difficulties.

Basically, I have normal text field logically defined in
String*2,
       vv  vv
     AABBCCDD ...
     ^^  ^^
and I want do a query that selects on the records with (for example)
"BB".  The way I'm doing it now is to add some unique "mark" after each
logically group,
  ie. if I know the text string would not contain "Z" I would do,
       AAZBBZCCZDDZ ...
and get by with a SQL "LIKE '*BBZ*'"
(the "BB" group may not be the second group in the field)

Now, the real problem that I'm facing right now is that
each logical group (ie. BB) is not what I am really searching for, but
a range of the bit-masked version.
  ie. if I masked off the first byte, I'll end up with a B, and I
      will want to select the records where that character is in the
      range "A" to "Z".
A slow way to do this would be to do a SQL that selects with as much
criterion as possible, then do a record by record matching.  But this
would be very slow.

The reason I'm doing all this is that...

I first thought it would minimize storage space and increase
flexibility for expanding the database...

That text field can be expanded to numerous (over 200) integer fields,
corresponding to each logical group.
Some bits of the group is used to define the "name of the integer fields",
and some bits are used to define the "value of the integer fields".
I know that for each record, only a few (~10) of these integer fields
will have values, and I know the range of the possible values of
those fields.

So my question is, is there a way to do what I wanted to do with
the database structure that I'm using?  Is there perhaps a better
method (structure)?  Or should I expand the text field into
integer fields?

Thanks in advance,
Any helps will be greatly appreciated,

David Ng

PS:  If there the SQL statments can filter using criteria base
     on the return value of a user-defined function operating on
     a particular field, this problem can easily be solved.  Does
     anyone know of such .VBX/.DLL?



Sat, 27 Dec 1997 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Rich Text Box: Coloring portions of the text

2. How to get a recordset with portion of fields from another recordset

3. Creating a text/html from query field data

4. Starting query from a form (criterium being based on a text field in the form)

5. Protect portions of text from editing

6. combo box ? text portion

7. Highlighting data in the text portion of a combo box and overwriting it upon data entry

8. combo box ? text portion

9. Please tell me what I am doing wrong - DAO parameter Append Query :(

10. To the person doing the Skills Search query

11. How to knowing when a query is done

12. Doing a Query in VB.NET

 

 
Powered by phpBB® Forum Software