Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42257

autofill of TextBox according to the value in another TextBox

$
0
0
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:
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

Thanks in advance.

Viewing all articles
Browse latest Browse all 42257

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>