**最基本的对数据库进行的修改操作,给大家来个最简单的,看图:
就拿“修改基本数据”来说:

下边是代码:
Option Explicit
Const xStr As String = "0123456789"
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then cmdok_Click
End Sub
Private Sub form_load()
Txtsql = "select * from basicdata_info"
Set mrc = ExecuteSQl(Txtsql, msgTxt)
Text1.Text = mrc.Fields(0)
Text2.Text = mrc.Fields(1)
Text3.Text = mrc.Fields(2)
Text4.Text = mrc.Fields(3)
Text5.Text = mrc.Fields(4)
Text6.Text = mrc.Fields(5)
Me.KeyPreview = True
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
KeyAscii = IIf(InStr(xStr & Chr(8), Chr(KeyAscii)), KeyAscii, 0)
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
KeyAscii = IIf(InStr(xStr & Chr(8), Chr(KeyAscii)), KeyAscii, 0)
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
KeyAscii = IIf(InStr(xStr & Chr(8), Chr(KeyAscii)), KeyAscii, 0)
End Sub
Private Sub Text5_KeyPress(KeyAscii As Integer)
KeyAscii = IIf(InStr(xStr & Chr(8), Chr(KeyAscii)), KeyAscii, 0)
End Sub
Private Sub Text6_KeyPress(KeyAscii As Integer)
KeyAscii = IIf(InStr(xStr & Chr(8), Chr(KeyAscii)), KeyAscii, 0)
End Sub
Private Sub command3_Click()
Unload Me
End Sub
Private Sub cmdok_Click()
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Txtsql = "select * from basicdata_info"
Set mrc = ExecuteSQl(Txtsql, msgTxt)
mrc.Fields(0) = Trim(Text1.Text)
mrc.Fields(1) = Trim(Text2.Text)
mrc.Fields(2) = Trim(Text3.Text)
mrc.Fields(3) = Trim(Text4.Text)
mrc.Fields(4) = Trim(Text5.Text)
mrc.Fields(5) = Trim(Text6.Text)
mrc.Fields(6) = UserName
mrc.Fields(7) = Date
mrc.Fields(8) = Time
mrc.Update
mrc.Close
MsgBox "基本数据设定成功!", vbOKOnly + vbExclamation, "提示"
End Sub
Private Sub cmdchange_Click()
Text1.Enabled = True
Text2.Enabled = True
Text4.Enabled = True
Text5.Enabled = True
Text6.Enabled = True
End Sub
以上代码就是我的机房收费系统的修改基本数据的全部代码,嘿嘿!**