I'm trying to build a Indonesian-english dictionary/translator
aplication.
I have an unbound form (Form1) with two text field (text1) & (text2)
and two command button (command1) and (command2).
My aim is to type sentences in Indonesian in text1 and translate into
english into text2 trough steps as follows:
1. split the sentences in text1 and store it into tabel T_TEMP (i've
succeded with this )
2. Compare the words in T_TEMP with the table T_MyDict
3. show the result in text2
This is the code i've done so far :
command1 is link to this code:
Private Sub Command1_Click()
Dim MyRST As DAO.Recordset
Set MyDB = CurrentDb
Set MyRST = MyDB.OpenRecordset("T_TEMP", dbOpenDynaset)
Dim i As Integer
'delete temp data
DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE * FROM T_TEMP"
DoCmd.SetWarnings True
'
Text1 = Text1 & " " 'add a space just in case 'its just one word
Words = Split(Text1, " ")
With MyRST
For Wordnum = 0 To UBound(Words)
.AddNew
!ID = Wordnum
!mytext = Words(Wordnum)
!txt2 = DLast("mytext", "T_TEMP", "mytext is not null") & " "
& !mytext
'use this to handle two words that have one meaning eg. "rumah
tangga" means "households" in bahasa Indonesia
!txt3 = DLast("txt2", "T_TEMP", "txt2 is not null") & " " & !
mytext
'use this to handle THREE words that have one meaning eg. "DEWAN
PERWAKILAN RAKYAT" means "PARLIAMENT" in bahasa Indonesia
.Update
Next Wordnum
End With
End Sub
command2 is link to this code:
Private Sub Command2_Click()
call translateIt
End sub
Public Function TranslateIt() As String
Dim dbs As Database, rstMydict As Recordset, rstTemp As Recordset
Dim NumRec As Long
Set dbs = CurrentDb ' Return reference to current database.
Set rstTemp = dbs.OpenRecordset("T_Temp")
Set rstMydict = dbs.OpenRecordset("T_Mydict", , dbOpenDynaset)
' Set index for SEEK
'rstTemp.Index = "primarykey"
'rstTemp.Index = "mytext"
rstMydict.MoveFirst
Do Until rstTemp.EOF = True
rstTemp.Seek "=", rstMydict!Field1 ', rstTemp!Width
If rstTemp.NoMatch Then
Else
rstTemp.Edit
rstTemp!trnsResult = rstMydict!ENGLS
rstTemp.Update
End If
rstMydict.MoveNext
NumRec = NumRec + 1
Loop
rstTemp.Close
rstMydict.Close
Set dbs = Nothing
MsgBox NumRec - 1 & " Records Processed"
End Function
If i click command2
this error apear:
Runtime error 3265
item no found in this collection
T_TEMP:
MyText
trnsResult
T_Mydict:
Field1 (Indonesian words)
ENGLS (English words)
is there any sugestion on how to solve this
TIA,
Billy