473,385 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

VB Text reader saved as Text/Ms Access

Dököll
2,364 Expert 2GB
Greetings and Salutations!

You deserve a look at the finished product you have helped build. Will only post part of the code, judging by the massive if statement included:

'Application: Lyrical Content Reader Software
'Licensed To: Shunji Moriwaki
'Programmer: Dököll Solutions, Inc.
'Date: 01/31/07
'Time: 15:45 AM
'Credits: Prof. Roger Uvyn, My wife, My boys, Rick, Mike, Steve, Killer, Will
'Path: Anywhere

Expand|Select|Wrap|Line Numbers
  1.  
  2. 'Load starts here
  3. Private Sub Form_Load()
  4. AddTo.Visible = True  'Button adding lyrics in
  5. GetItGood.Visible = False 'Continue button
  6.  
  7. Text2(0).Text = "Sunspots" 'First textbox
  8.  
  9. 'Sunspots
  10. Text2(1).Text = "Sunshine" 'Second textbox
  11.  
  12. 'Sunspots
  13. Text2(2).Text = "Sunny"
  14.  
  15. 'Sunspots
  16. Text2(3).Text = "Sundown"
  17.  
  18. 'Sunspots
  19. Text2(4).Text = "Sunset"
  20.  
  21. 'Sun
  22. Text2(5).Text = "Sun"
  23.  
  24. 'Sunbeam
  25. Text2(6).Text = "Sunbeam"
  26.  
  27. 'Sunlight
  28. Text2(7).Text = "Sunlight"
  29.  
  30. 'Sunspot
  31. Text2(8).Text = "Sunspot"
  32.  
  33.  
  34. 'Rainy
  35. Text2(9).Text = "Rainy"
  36.  
  37. 'Rain
  38. Text2(10).Text = "Rain"
  39.  
  40. 'Raining
  41. Text2(11).Text = "Raining"
  42.  
  43. 'Rained
  44. Text2(12).Text = "Rained"
  45.  
  46. 'Rains
  47. Text2(15).Text = "Rains"
  48.  
  49.  
  50. 'Rainfall
  51. Text2(19).Text = "Rainfall"
  52.  
  53.  
Above words are part of Tab One in the program
Feb 12 '07 #1
18 2030
Dököll
2,364 Expert 2GB
Courtesy of Killer, Will, Steve, Mike and Rick and Me:


Part One

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub AddTo_Click() 'Add button enable lyrics in
  3.  
  4. If Text6.Text = "" Then 'Making sure text6 is not empty
  5. MsgBox ("Looks, you forgot to add a lyric please add lyrical text to continue!")
  6. Text6.SetFocus
  7. Else
  8.  
  9. Text6.SelStart = Len(Text6.Text) 'loads additional lyrics in phantom textbox
  10. Text6 = LCase$(Text6)
  11.  
  12. LyricalContentfind.Text6.Text = Text6.Text 'this and phantom textbox equal ><
  13.  
  14.  
  15.  
  16.  
  17.   Dim P As Long 'textbox 6 must find words in form load or else
  18.   Dim s1 As String 'replace all instances of carriage returns and so on...
  19.   s1 = Text6.Text
  20.  
  21.  
  22.   s1 = Replace(s1, vbNewLine & vbNewLine, " ")
  23.   s1 = Replace(s1, vbNewLine, " ")
  24.   s1 = Replace(s1, vbTab, vbNewLine)
  25.  
  26.   s1 = Replace(s1, ".", " ")
  27.   s1 = Replace(s1, ",", " ")
  28.   s1 = Replace(s1, "'", " ")
  29.  
  30.   s1 = Replace(s1, ";", " ")
  31.   s1 = Replace(s1, ":", " ")
  32.   s1 = Replace(s1, "?", " ")
  33.  
  34.   s1 = Replace(s1, "!", " ")
  35.   s1 = Replace(s1, "(", " ")
  36.   s1 = Replace(s1, ")", " ")
  37.   s1 = Replace(s1, "-", " ")
  38.  
  39.   Text6.Text = s1
  40.  
  41.  
Feb 12 '07 #2
Dököll
2,364 Expert 2GB
Part Two

Expand|Select|Wrap|Line Numbers
  1.  
  2. 'Page 1 Text
  3. 'Below attempts to compare words from form load against Text6 textbox
  4. 'Self-explainatory, if Text2(0) does not find Sun-like words, 
  5. 'Sun does not get loaded
  6.  
  7.   P = WordFoundInText(Text2(0).Text, Text6.Text)
  8.  
  9. If P Then
  10.   LyricalContentfind.Text2(0).Text = "Sun"
  11.   'BringInTheOrgans.color_change
  12.  
  13.     Else
  14.  
  15.     Text6.SetFocus
  16.     Text6.SelLength = Len(Text2(0).Text)
  17.     LyricalContentfind.Text2(0).Visible = False
  18.     'TextAppear.color_change
  19.  
  20.   End If
  21.  
  22.  
Feb 12 '07 #3
Dököll
2,364 Expert 2GB
Part Three:

Expand|Select|Wrap|Line Numbers
  1.  
  2. GetItGood.Visible = True 'Appears and to make available tabs
  3. GtWords.Visible = False 'disappears to enable 'Continue' button
  4. Text6.Locked = True 'locks text to disable user changes to text
  5.  
  6.  
  7. End Sub 'End of program
  8.  
  9.  
Feb 12 '07 #4
Dököll
2,364 Expert 2GB
An attempt to load screen shots failed. Many thanks for all your assistance :-)

Dököll
Feb 12 '07 #5
Dököll
2,364 Expert 2GB
Pics were never loaded as expected:
Mar 12 '07 #6
Dököll
2,364 Expert 2GB
Another whirl for for snapshots to load...
Mar 14 '07 #7
Dököll
2,364 Expert 2GB
More snapshot attempts:

[IMG]AddLyric-2007-22-02.bmp[/IMG]

[IMG]BodyPartsTextboxes.bmp[/IMG]
Mar 14 '07 #8
Dököll
2,364 Expert 2GB
Saving data gathered for each lyric as .txt. Please be aware you are saving and erasing what you have in the text file. Your text file will load depending on where the application is installed...


Expand|Select|Wrap|Line Numbers
  1. Dim io() As String 'dimensioned for each word added to arrary
  2. Dim prs_calc As Integer 'dimensioned to calculate each user log in to enter this data
  3. Dim ndvdl As Integer 'dimensioned as counter for 19 pieces of data each time user logs in
  4. Dim my_string As String ' dimensioned for returned (Retrieve button 2 b added later) value from .txt file, where needed
  5.  
  6. Private Sub subt_Click()   'this function will load entry into array
  7.     io(prs_calc, 1) = Text2(0).Text      'first word in list of 19 pieces of data about lyric to be submitted
  8.     io(prs_calc, 2) = Text2(1).Text      '2nd info, piece of data, if it exists in a lyric that is enterred...
  9.     io(prs_calc, 3) = Text2(2).Text
  10.     io(prs_calc, 4) = Text2(3).Text
  11.     io(prs_calc, 5) = Text2(4).Text
  12.     io(prs_calc, 6) = Text2(5).Text
  13.     io(prs_calc, 7) = Text2(6).Text
  14.     io(prs_calc, 8) = Text2(7).Text
  15.     io(prs_calc, 9) = Text2(8).Text
  16.     io(prs_calc, 10) = Text2(9).Text
  17.     io(prs_calc, 11) = Text2(10).Text
  18.     io(prs_calc, 12) = Text2(11).Text
  19.     io(prs_calc, 13) = Text2(12).Text
  20.     io(prs_calc, 14) = Text2(13).Text
  21.     io(prs_calc, 15) = Text2(14).Text
  22.     io(prs_calc, 16) = Text2(15).Text
  23.     io(prs_calc, 17) = Text2(16).Text
  24.     io(prs_calc, 18) = Text2(17).Text
  25.     io(prs_calc, 19) = Text2(18).Text
  26.  
  27.  
  28.         If (prs_calc = ndvdl) Then     'this logic caculates user entries and number of entries
  29.             subt.Visible = False 'button disappears depending on the number of entries set by user before running program
  30.         End If
  31.  
  32.         prs_calc = prs_calc + 1 'calculation for user entries
  33.  
  34.  
  35. 'this function will write to file
  36.  
  37. filenum1 = FreeFile           'freefile allows a standby method in case of slow data
  38. Dim KalKulator As Integer     'info that will be written each time a user inputs his/her data
  39. KalKulator = 1
  40. Dim array_clear_cntr As Integer ' data counter being recorded and cleared upon entry
  41.  
  42.  
  43.  
  44. If (io(KalKulator, 1) <> "") Then
  45.  
  46.     Do While KalKulator < prs_calc 'self-explanatory, please reply for more info
  47.  
  48.         Open App.Path + "\usermate.txt" For Append As filenum1    'this text file is created automatically with the "append method", deletes previous entries...
  49.         Write #filenum1, io(KalKulator, 1), io(KalKulator, 2), io(KalKulator, 3), io(KalKulator, 4), io(KalKulator, 5), io(KalKulator, 6), io(KalKulator, 7), io(KalKulator, 8), io(KalKulator, 9), io(KalKulator, 10), io(KalKulator, 11), io(KalKulator, 12), io(KalKulator, 13), io(KalKulator, 14), io(KalKulator, 15), io(KalKulator, 16), io(KalKulator, 17), io(KalKulator, 18), io(KalKulator, 19)
  50.        array_clear_cntr = 1
  51.                     Do While array_clear_cntr < 20 'set to 20, we need less than 20, thus 19 pieces of data to be issued
  52.                             io(KalKulator, array_clear_cntr) = ""
  53.                             array_clear_cntr = array_clear_cntr + 1
  54.                     Loop
  55.          Close filenum1
  56.         KalKulator = KalKulator + 1
  57.  
  58.     Loop
  59.  
  60.     End If
  61.  
  62.     'there is a better method for this, please try a For Loop with this one
  63.     'empties your textboxes after engraving data to .txt file
  64.  
  65.         Text2(0).Text = ""
  66.         Text2(1).Text = ""
  67.         Text2(2).Text = ""
  68.         Text2(3).Text = ""
  69.         Text2(4).Text = ""
  70.         Text2(5).Text = ""
  71.         Text2(6).Text = ""
  72.         Text2(7).Text = ""
  73.         Text2(8).Text = ""
  74.         Text2(9).Text = ""
  75.         Text2(10).Text = ""
  76.         Text2(11).Text = ""
  77.         Text2(12).Text = ""
  78.         Text2(13).Text = ""
  79.         Text2(14).Text = ""
  80.         Text2(15).Text = ""
  81.         Text2(16).Text = ""
  82.         Text2(17).Text = ""
  83.         Text2(18).Text = ""
  84.         Text2(19).Text = ""
  85.  
  86.         Text2(0).SetFocus 'we need our cursor back to the first textbox here for more data to be added
  87.  
  88. End Sub
  89.  
  90.  
  91.  
Have fun :-)
Mar 16 '07 #9
Dököll
2,364 Expert 2GB
The word is in, I can add the additional criteria. Form Load code...

Expand|Select|Wrap|Line Numbers
  1.  
  2.     ndvdl = Int(InputBox("How many lyrics do you wish to search?"))  'this pop-up box is used for number of entries
  3.     ReDim io(ndvdl, 19)  'redimensioned for data calculation in 19 Textboxes
  4.     prs_calc = 1 'Sets limit after user reaches number entries specified
  5.  
  6.  
...calculates number of entries buy each user. When user has reached limit, subt button disappears. I am glad. I suggested this and was patiently hoping to add. Think about it, if each user entries can be calculated before each entry, m buddy can set/limit entries by each.

Please comment if you need clarification :-)
Mar 19 '07 #10
Dököll
2,364 Expert 2GB
Part 6

Retrieving user data from .txt file:

Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. 'this redeems all data written to file Info1,2,3 and so on represent io array 1,2,3 so on and so forth
  4.  
  5. Private Sub retrieve_Click()
  6.     Dim user_req As Integer 
  7.     Dim record_cntr As Integer
  8.     Dim location_cntr As Integer
  9.     Dim x As Integer
  10.  
  11.     Dim my_char As String
  12.     Dim test_string As String
  13.     Dim my_string As String
  14.  
  15.     Dim Info1 As String
  16.     Dim Info2 As String
  17.     Dim Info3 As String
  18.     Dim Info4 As String
  19.     Dim Info5 As String
  20.     Dim Info6 As String
  21.     Dim Info7 As String
  22.     Dim Info8 As String
  23.     Dim Info9 As String
  24.     Dim Info10 As String
  25.     Dim Info11 As String
  26.     Dim Info12 As String
  27.     Dim Info13 As String
  28.     Dim Info14 As String
  29.     Dim Info15 As String
  30.     Dim Info16 As String
  31.     Dim Info17 As String
  32.     Dim Info18 As String
  33.     Dim Info19 As String
  34.  
  35.  
  36.     record_cntr = 1 'records number of enties to retrieve
  37.     test_string = Text1.Text
  38.     test_l = Len(test_string)
  39.  
  40.     Do While x < test_l
  41.         my_char = InStr(x, test_string)
  42.         Select Case my_char
  43.         Case "1"
  44.         Case "2"
  45.         Case "3"
  46.         Case "4"
  47.         Case "5"
  48.         Case "6"
  49.         Case "7"
  50.         Case "8"
  51.         Case "9"
  52.         Case "0"
  53.         Case Else
  54.             MsgBox ("Sorry, you must enter a number!") 'A bit more sophistication can be added here to not allow unknown chars
  55.             bomb = 99999
  56.         End Select
  57.         x = x + 1
  58.     Loop
  59.  
  60.  
  61.  
  62.     If (bomb <> 99999) Then
  63.  
  64.                 user_req = Int(Text1.Text)
  65.  
  66.  
  67.                     filenum1 = FreeFile
  68.                 Open App.Path + "\usermate.txt" For Input As #filenum1 'First attempt to read the file to find number of entries added
  69.  
  70.  
  71.                     Do While Not EOF(filenum1) 
  72.                             Input #filenum1, Info1, Info2, Info3, Info4, Info5, Info6, Info7, Info8, Info9, Info10, Info11, Info12, Info13, Info14, Info15, Info16, Info17, Info18, Info19
  73.                             record_cntr = record_cntr + 1 
  74.                     Loop
  75.                     Close filenum1
  76.  
  77.  
  78.                     If record_cntr < user_req Then
  79.                         MsgBox ("There are only " & (record_cntr - 1) & " records in the file so we will show all those records.")'Communicates entries found
  80.                     End If
  81.  
  82.                 Open App.Path + "\usermate.txt" For Input As #filenum1 'Second attempt to read the file, but this time to locate number of entries specified by user in Text1.Text
  83.  
  84.                 location_cntr = 1 'locates number of entries specified by user
  85.                     Do While Not EOF(filenum1) 
  86.                         Input #filenum1, Info1, Info2, Info3, Info4, Info5, Info6, Info7, Info8, Info9, Info10, Info11, Info12, Info13, Info14, Info15, Info16, Info17, Info18, Info19
  87.  
  88.                             If (location_cntr >= (record_cntr - user_req)) Then
  89.                                     my_string = my_string + Info1 + " - " + Info2 + " - " + Info3 + " - " + Info4 + " - " + Info5 + " - " + Info6 + " - " + Info7 + " - " + Info8 + " - " + Info9 + " - " + Info10 + "-" + Info11 + " - " + Info12 + " - " + Info13 + " - " + Info14 + " - " + Info15 + " - " + Info16 + " - " + Info17 + " - " + Info18 + " - " + Info19 + vbCrLf
  90.                             End If
  91.                             location_cntr = location_cntr + 1
  92.                     Loop
  93.  
  94.                 Close filenum1
  95.                         dthld.Text = my_string    'this textbox is our container for data which have been recalled from file
  96.     End If
  97. End Sub
  98.  
  99.  
  100.  
Please ask if this does not make sense. Going forward, next step in this project is to relay the data to an Access database as a second option...

Enjoy!
Mar 19 '07 #11
Dököll
2,364 Expert 2GB
The first post did not include all of the available fields. The information should be helpful nonetheless if you are accurately reading the code. I have skipped some fields, an error of mine. It wenrt crazy from Text2(12)...Please add some dummy weather related words to Text2(13) and so on to fit your purpose, Sorry about that. Perhpas, I should maintain my composure when the code works :-)

I am now adding and Access database code I ahve been working on to enable storage capacity and to make it simpler to modify the data gathered/entered.

In a bit!
Mar 23 '07 #12
Dököll
2,364 Expert 2GB
Step 8

Saving to Access

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub SendToDB_Click()   'this funtion will load entry into database
  3.  
  4.         Dim my_database As Database
  5.         Set my_database = OpenDatabase("C:\DataMining\Data_Central.mdb")
  6.         my_database.Execute "insert into Data_Central.Lyrics(Sun1, Sun2, Sun3, Sun4,Sun5,Sun6,Sun7,Sun8,Rain1, Rain2,Rain3,Rain4,Rain5,Rain6,Rain7,Rain8,Rain9,Rain10,Rain11) Values('" & Text1(0).Text & "','" & Text1(1).Text & "' , '" & Text1(2).Text & "' , '" & Text1(3).Text & "','" & Text1(4).Text & "' , '" & Text1(5).Text & "' ,'" & Text1(6).Text & "' ,'" & Text1(7).Text & "' ,'" & Text1(8).Text & "' ,'" & Text1(9).Text & "' ,'" & Text1(10).Text & "' ,'" & Text1(11).Text & "' ,'" & Text1(12).Text & "','" & Text1(13).Text & "' ,'" & Text1(14).Text & "' ,'" & Text1(15).Text & "' ,'" & Text1(16).Text & "' ,'" & Text1(17).Text & "' ,'" & Text1(18).Text & "' ,'" & Text1(19).Text & "')"
  7.         my_database.Close
  8.  
  9. End Sub
  10.  
  11.  
Mar 24 '07 #13
Dököll
2,364 Expert 2GB
Modification to previous post, Append command saves to end of list, my brain went to sleep there...

Saving data gathered for each lyric as .txt. Submitting and adding to existing text in file. Text file will be loaded/added depending on where the application is installed...


Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim io() As String 'dimensioned for each word added to arrary
  3. Dim prs_calc As Integer 'dimensioned to calculate each user log in to enter this data
  4. Dim ndvdl As Integer 'dimensioned as counter for 19 pieces of data each time user logs in
  5. Dim my_string As String ' dimensioned for returned (Retrieve button 2 b added later) value from .txt file, where needed
  6.  
  7. Private Sub subt_Click()   'this function will load entry into array
  8.     io(prs_calc, 1) = Text2(0).Text      'first word in list of 19 pieces of data about lyric to be submitted
  9.     io(prs_calc, 2) = Text2(1).Text      '2nd info, piece of data, if it exists in a lyric that is enterred...
  10.     io(prs_calc, 3) = Text2(2).Text
  11.     io(prs_calc, 4) = Text2(3).Text
  12.     io(prs_calc, 5) = Text2(4).Text
  13.     io(prs_calc, 6) = Text2(5).Text
  14.     io(prs_calc, 7) = Text2(6).Text
  15.     io(prs_calc, 8) = Text2(7).Text
  16.     io(prs_calc, 9) = Text2(8).Text
  17.     io(prs_calc, 10) = Text2(9).Text
  18.     io(prs_calc, 11) = Text2(10).Text
  19.     io(prs_calc, 12) = Text2(11).Text
  20.     io(prs_calc, 13) = Text2(12).Text
  21.     io(prs_calc, 14) = Text2(13).Text
  22.     io(prs_calc, 15) = Text2(14).Text
  23.     io(prs_calc, 16) = Text2(15).Text
  24.     io(prs_calc, 17) = Text2(16).Text
  25.     io(prs_calc, 18) = Text2(17).Text
  26.     io(prs_calc, 19) = Text2(18).Text
  27.  
  28.  
  29.         If (prs_calc = ndvdl) Then     'this logic caculates user entries and number of entries
  30.             subt.Visible = False 'button disappears depending on the number of entries set by user before running program
  31.         End If
  32.  
  33.         prs_calc = prs_calc + 1 'calculation for user entries
  34.  
  35.  
  36. 'this function will write to file
  37.  
  38. filenum1 = FreeFile           'freefile allows a standby method in case of slow data
  39. Dim KalKulator As Integer     'info that will be written each time a user inputs his/her data
  40. KalKulator = 1
  41. Dim array_clear_cntr As Integer ' data counter being recorded and cleared upon entry
  42.  
  43.  
  44.  
  45. If (io(KalKulator, 1) <> "") Then
  46.  
  47.     Do While KalKulator < prs_calc 'self-explanatory, please reply for more info
  48.  
  49.         Open App.Path + "\usermate.txt" For Append As filenum1    'this text file is created automatically with the "append method", deletes previous entries...
  50.         Write #filenum1, io(KalKulator, 1), io(KalKulator, 2), io(KalKulator, 3), io(KalKulator, 4), io(KalKulator, 5), io(KalKulator, 6), io(KalKulator, 7), io(KalKulator, 8), io(KalKulator, 9), io(KalKulator, 10), io(KalKulator, 11), io(KalKulator, 12), io(KalKulator, 13), io(KalKulator, 14), io(KalKulator, 15), io(KalKulator, 16), io(KalKulator, 17), io(KalKulator, 18), io(KalKulator, 19)
  51.        array_clear_cntr = 1
  52.                     Do While array_clear_cntr < 20 'set to 20, we need less than 20, thus 19 pieces of data to be issued
  53.                             io(KalKulator, array_clear_cntr) = ""
  54.                             array_clear_cntr = array_clear_cntr + 1
  55.                     Loop
  56.          Close filenum1
  57.         KalKulator = KalKulator + 1
  58.  
  59.     Loop
  60.  
  61.     End If
  62.  
  63.     'there is a better method for this, please try a For Loop with this one
  64.     'empties your textboxes after engraving data to .txt file
  65.  
  66.         Text2(0).Text = ""
  67.         Text2(1).Text = ""
  68.         Text2(2).Text = ""
  69.         Text2(3).Text = ""
  70.         Text2(4).Text = ""
  71.         Text2(5).Text = ""
  72.         Text2(6).Text = ""
  73.         Text2(7).Text = ""
  74.         Text2(8).Text = ""
  75.         Text2(9).Text = ""
  76.         Text2(10).Text = ""
  77.         Text2(11).Text = ""
  78.         Text2(12).Text = ""
  79.         Text2(13).Text = ""
  80.         Text2(14).Text = ""
  81.         Text2(15).Text = ""
  82.         Text2(16).Text = ""
  83.         Text2(17).Text = ""
  84.         Text2(18).Text = ""
  85.         Text2(19).Text = ""
  86.  
  87.         Text2(0).SetFocus 'we need our cursor back to the first textbox here for more data to be added
  88.  
  89. End Sub
  90.  
  91.  
Mar 25 '07 #14
Dököll
2,364 Expert 2GB
This is Step 8 modified. Ran the application, and got an error. Wrong Textboxes added :-)

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub SendToDB_Click()   'this funtion will load entry into database
  3.  
  4.         Dim my_database As Database
  5.         Set my_database = OpenDatabase("C:\DataMining\Data_Central.mdb")
  6.         my_database.Execute "insert into Data_Central.Lyrics(Sun1, Sun2, Sun3, Sun4,Sun5,Sun6,Sun7,Sun8,Rain1, Rain2,Rain3,Rain4,Rain5,Rain6,Rain7,Rain8,Rain9,Rain10,Rain11) Values('" & Text2(0).Text & "','" & Text2(1).Text & "' , '" & Text2(2).Text & "' , '" & Text2(3).Text & "','" & Text2(4).Text & "' , '" & Text2(5).Text & "' ,'" & Text2(6).Text & "' ,'" & Text2(7).Text & "' ,'" & Text2(8).Text & "' ,'" & Text2(9).Text & "' ,'" & Text2(10).Text & "' ,'" & Text2(11).Text & "' ,'" & Text2(12).Text & "','" & Text2(13).Text & "' ,'" & Text2(14).Text & "' ,'" & Text2(15).Text & "' ,'" & Text2(16).Text & "' ,'" & Text2(17).Text & "' ,'" & Text2(18).Text & "' ,'")"
  7.         my_database.Close
  8.  
  9. End Sub
  10.  
Mar 25 '07 #15
Dököll
2,364 Expert 2GB
Step 9, category specific:


Expand|Select|Wrap|Line Numbers
  1.  
  2. 'this is searching for existing words added frorm lyrics,starting with Sun
  3. Private Sub Seek_Click()
  4. Dim my_database As Database           'dimension database as database so program knows where to look for data
  5. Dim my_record As Recordset
  6. Dim test As String
  7. test = Text2(0).Text
  8. Set my_database = OpenDatabase("C:\DataMining\Data_Central.mdb")   'this function will open the database using the link to the access database (provided that it is closed access)
  9. Set my_record = my_database.OpenRecordset("select * from Lyrics where Sun1 like '" & Text2(0).Text & "'")    ' this is used to search by first category listing, only if data already exists
  10.    Do While Not my_record.EOF  'this function will keep searching for fields matching each textbox
  11.  
  12.         Text2(0).Text = my_record.Fields("Sun1")
  13.         Text2(1).Text = my_record.Fields("Sun2")
  14.         Text2(2).Text = my_record.Fields("Sun3")
  15.         Text2(3).Text = my_record.Fields("Sun4")
  16.         Text2(4).Text = my_record.Fields("Sun5")
  17.         Text2(5).Text = my_record.Fields("Sun6")
  18.         Text2(6).Text = my_record.Fields("Sun7")
  19.         Text2(7).Text = my_record.Fields("Sun8")
  20.         Text2(8).Text = my_record.Fields("Sun8")
  21.         Text2(9).Text = my_record.Fields("Rain1")
  22.         Text2(10).Text = my_record.Fields("Rain2")
  23.         Text2(11).Text = my_record.Fields("Rain3")
  24.         Text2(12).Text = my_record.Fields("Rain4")
  25.         Text2(13).Text = my_record.Fields("Rain5")
  26.         Text2(14).Text = my_record.Fields("Rain6")
  27.         Text2(15).Text = my_record.Fields("Rain7")
  28.         Text2(16).Text = my_record.Fields("Rain8")
  29.         Text2(17).Text = my_record.Fields("Rain9")
  30.         Text2(18).Text = my_record.Fields("Rain10")
  31.         Text2(19).Text = my_record.Fields("Rain11")
  32.  
  33.    my_record.MoveNext
  34.    Loop
  35.    my_database.Close
  36. End Sub
  37.  
  38.  
Mar 25 '07 #16
Dököll
2,364 Expert 2GB
Step 1 is missing: io(prs_calc, 20) = Text2(19).Text
Step 8 is missing Text2(19).Text...
Mar 25 '07 #17
Dököll
2,364 Expert 2GB
For our lucky number 7, before entering double digits...

Step 7 Delete command

This is important because the will be a number of lyrics were Sunpots are recorded. Sir Moriwaki does not yet need this, I know he will in the future:

Expand|Select|Wrap|Line Numbers
  1.  
  2. 'we hope to delete repeated words
  3.  
  4. Private Sub dll_Click()
  5. Dim my_database As Database
  6. Dim my_record As Recordset
  7. Set my_database = OpenDatabase("C:\DataMining\Data_Central.mdb")
  8. Set my_record = my_database.OpenRecordset("select * from Lyrics where Sun1='" & Text2(0).Text & "'")
  9. If Not my_record.EOF Then
  10. my_record.Delete
  11. End If
  12. my_database.Close
  13.  
  14. End Sub
  15.  
  16.  
Please note: The Access Database is added to C:. You can modify the code, add database to location of choice...
Mar 25 '07 #18
Dököll
2,364 Expert 2GB
Groovy, double digits:

Step 10: Refreshing/clearing screen


Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub RefreshTextboxes() 
  3.  
  4. For i = 0 To Text2().UBound 
  5.  
  6. Text2(i).Text = "" 
  7.  
  8. Next 
  9.  
  10. End Sub 
  11.  
  12.  
Smooth way of deleting textbox data for further entries...
Mar 25 '07 #19

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Sam Lowry | last post by:
Greetings. I am trying to do something which should elementary for Perl, but I have only been able to find bits and pieces on it. When I put the bits together they do not work. Maybe I am going...
13
by: MLH | last post by:
I have a form with two controls: !! - combo box !! - text box A button on the form tries to run this SQL when clicked... INSERT INTO BodyMsgsSent (ToWhom, BodyText) SELECT DISTINCTROW !! AS...
6
by: Einar Høst | last post by:
Hi I'm trying to learn a bit about performance, hope someone can help me out I have a text file with 8-bit characters in it. In order to improve performance, I'm using a BinaryReader instead of...
16
by: Christine | last post by:
I was wondering if it is possible to read in a text file as a data type other than string. I would like to read it in as some type that handles numbers, like double, or float.
4
by: Zephyr . via .NET 247 | last post by:
(Type your message here) -------------------------------- From: Zephyr . hey, i got trouble getting integers out of a plain text file. i dont want to use binary files, just plain text files...
6
by: Adrian Lin | last post by:
Is there a way to read a specfic line in a text file? For instance if I wanted to just read the 5th line is that possible without having to step through the other lines? Essentially I am doing huge...
12
by: Jerry Camel | last post by:
Not sure if this is a good place to post this... I'm writing and ASP.net app using vb .net. I need to interact with a credit card reader. I have one that sits inline with the keyboard. Works...
3
by: John Meyer | last post by:
The console code is working just fine, but it isn't putting in the text boxes. P.S I'm using a while loop, but I'm only expecting one answer but I haven't found a good way to process one record....
8
by: iheartvba | last post by:
Hi I am using Access 2007 and am trying to export a query to a fixed length text file. I tried using the following code to export the text file: DoCmd.TransferText acExportFixed, , "qryFFRDeFile",...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.