Else If EnglishWordTxt.Text = EnglishWordTxt.Text Then
Private Sub ConvertMalay_Click() 'if user not type anything If EnglishWordTxt.Text = "" Then TextMessage1 = MsgBox("Please type the word first", vbOKOnly, "Caution") 'Lets see if user type a word that's in the database Else If EnglishWordTxt.Text = EnglishWordTxt.Text Then 'set up remote data connection using the MySQL ODBC driver cnMySql.CursorDriver = rdUseOdbc cnMySql.Connect = "uid=root;pwd=1234;server=localhost;" & _ "driver={MySQL ODBC 3.51 Driver};database=kamus;dsn='';" cnMySql.EstablishConnection With rdoQry .Name = "malayword" .SQL = "SELECT malayword, explanation FROM a WHERE englishword = '" & EnglishWordTxt.Text & "'" .RowsetSize = 1 Set .ActiveConnection = cnMySql Set rdoRS = .OpenResultset(rdOpenKeyset, rdConcurRowVer) End With MalayWordTxt.Text = "" ExplanationTxt.Text = "" With rdoRS MalayWordTxt.Text = MalayWordTxt.Text & !malayword ExplanationTxt.Text = ExplanationTxt.Text & !explanation End With rdoRS.Close cnMySql.Close If ExplanationTxt.Text = "" Then TextMessage2 = MsgBox("Sorry, your word is not in this dictionary", vbOKOnly, "Caution") End If End If End If End Sub
cnMySql.EstablishConnection