Categorizing techniques

JohnCTX 636 Reputation points
2021-03-23T17:05:48.203+00:00

I have typed out a file with its categories in parenthesis

(Flowers)
Lily
(Dogs - Domestic)
German Shepherd
(Flowers)
Rose
(Dogs - Domestic)
Collie

Here is the code snippet below:

Sub Categorize_Them()  
Dim lngX As Long  
  
lngX = 0  
  
lCatNumber(lngX) = 2  
  
Set DBZ = CurrentDb  
Set CatRecSet = DBZ.OpenRecordset("Categories", dbOpenDynaset)  
Set SubCatRecSet = DBZ.OpenRecordset("Sub Categories", dbOpenDynaset)  
  
  
intX = 1  
  
lngCatNumber = 1  
lngSubCatNumber = 1  
  
Open "C:\Users\POS\Documents\List of entries.txt" For Input As #1  
Do Until EOF(1)  
    Line Input #1, strInputX  
    Do Until CatRecSet.EOF  
        lngCatNumber = lngCatNumber + 1  
        If CatRecSet.NoMatch = False Then  
            Line Input #1, strInputZ  
            lngSubCatNumber = lngSubCatNumber + 1  
            SubCatRecSet.AddNew  
            SubCatRecSet.Fields(0).Value = lngSubCatNumber  
            SubCatRecSet.Fields(1).Value = strInputZ  
            SubCatRecSet.Fields(2).Value = lngCatNumber  
            SubCatRecSet.Update  
        End If  
        If CatRecSet.NoMatch = True Then  
            Line Input #1, strInputX  
        End If  
        CatRecSet.MoveNext  
    Loop  
      
Loop  
  
SubCatRecSet.Close  
CatRecSet.Close  
  
  
  
Close #2, 1  
  
End Sub  

The following contains data integrity errors.

80763-screenshot-43.png

Access Development
Access Development
Access: A family of Microsoft relational database management systems designed for ease of use.Development: The process of researching, productizing, and refining new or existing technologies.
893 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.