T
Tu
I make a list box in a form and write this code for this form:
' Code in module
Public noi As DAO.Database
Public Sub Ketnoi()
Set noi = CurrentDb()
End Sub
' Code in form
Dim rs1 As DAO.Recordset
Private Sub Form_Load()
Ketnoi
Set rs1 = noi.OpenRecordset(" select * from LOAISACH1 order by MaLoai asc ")
Set LstMang.Recordset = rs1
LstMang.Requery
End Sub
Private Sub LstMang_Click()
txtMaloai.SetFocus
txtMaloai.Text = rs1.Fields(0)
txtTenloai.SetFocus
txtTenloai.Text = rs1.Fields(1)
End Sub
LstMang is the list box, txtMaloai and txtTenloai are text boxs.
When i click on the list box to print the data on textbox, the programe
shows error: Run-time error '2115' The marcro or function set to the
BeforeUpdate or Validation Rule property for this field is preventing
Microsoft Office Access saving data in the field.
Please help me to solve this error. Thanks!
' Code in module
Public noi As DAO.Database
Public Sub Ketnoi()
Set noi = CurrentDb()
End Sub
' Code in form
Dim rs1 As DAO.Recordset
Private Sub Form_Load()
Ketnoi
Set rs1 = noi.OpenRecordset(" select * from LOAISACH1 order by MaLoai asc ")
Set LstMang.Recordset = rs1
LstMang.Requery
End Sub
Private Sub LstMang_Click()
txtMaloai.SetFocus
txtMaloai.Text = rs1.Fields(0)
txtTenloai.SetFocus
txtTenloai.Text = rs1.Fields(1)
End Sub
LstMang is the list box, txtMaloai and txtTenloai are text boxs.
When i click on the list box to print the data on textbox, the programe
shows error: Run-time error '2115' The marcro or function set to the
BeforeUpdate or Validation Rule property for this field is preventing
Microsoft Office Access saving data in the field.
Please help me to solve this error. Thanks!