Hai all members especially to senior members.
Breif details of the problem
Table name : accgeneral (Access 2003 table)
field names : AccNo, ClassNo
combobox : cmbAccNo
TextBox : txtClassNo.
cmbAccNo is binded to AccNo field of the accgeneral table
My requirement is when a select a AccNo value from the combobox, the txtClassNo have to be filled with the the ClassNo value of of the same record of from accgeneral table
I write the below code as below:
Thanks in advance.
Breif details of the problem
Table name : accgeneral (Access 2003 table)
field names : AccNo, ClassNo
combobox : cmbAccNo
TextBox : txtClassNo.
cmbAccNo is binded to AccNo field of the accgeneral table
My requirement is when a select a AccNo value from the combobox, the txtClassNo have to be filled with the the ClassNo value of of the same record of from accgeneral table
I write the below code as below:
Code:
Private Sub txtClassNo_Change()
Set rs = New ADODB.Recordset
connectDB
rs.Open "Select ClassNo from accgeneral where AccNo=" & cmbAccNo.Text, db, 3, 3
If rs.RecordCount > 0 Then
rs!ClassNo = txtClassNo.Text
Else
End If
If txtClassNo.Text = "" Then
MsgBox "UPDATE BOOK ENTRY DATABASE"
Else
End If
End Sub