VB对Microsoft Access数据库的调用管理
.用VB6.0计算机编程语言,和Microsoft Access数据库建立连接。以便对VB窗口控键,通过VB编程代码对Access数据库进行读取,存储,修改,编辑,管理和计算。(基本功能如下图)
编辑窗体界面及所需参数设计:VB窗体界面编辑及所需参数设计是下面相应控件属性及编程的基础和前提,.通过VB软件的工程下拉菜单的引用命令
实现VB和Microsoft Access数据库建立连接,以便进一步通过VB界面来对数据库的进一步操作。
具体对数据库的一般操作:首记录;上记录;下记录,末记录及搜索,修改,保存,新增记录等功能的详细VB代码如下:
Public mydb As Database
Public myrs As Recordset
Dim step1 As Integer
Private Sub Timer1_Timer()
Call mymove
End Sub
Public Sub mymove()
Label17.Move Label17.Left + 50 * step1
If Label17.Left + 1 * Label17.Width > Form1.Width Then
  step1 = -1
ElseIf Label17.Left < 0 Then
    step1 = 1
End If
End Sub
Private Sub Command10_Click()
Form1.Show
Form2.Hide
Form3.Hide
End Sub
Private Sub Command11_Click()
Form3.Show
Form2.Hide
Form1.Hide
End Sub
Private Sub Form_Load()
Dim i As Single
Set mydb = OpenDatabase(App.Path + "\合同数据库.mdb")
Set myrs = mydb.OpenRecordset("合同数据库", dbOpenDynaset)
Command9.Enabled = False
step1 = -1
Timer1.Interval = 100
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
简单的vb程序代码Text11.Text = ""
Text12.Text = ""
Text13.Text = ""
Text14.Text = ""
End Sub
Private Sub Command1_Click()                          '首记录
Dim nm As String
Dim nm1 As String
Dim nm2 As String
Command9.Enabled = False
Command12.Enabled = True
Command13.Enabled = True
Command2.Enabled = False
Command4.Enabled = True
Command1.Enabled = False
Command3.Enabled = True
myrs.MoveFirst
Call shuchu
End Sub
Private Sub Command2_Click()                            '上记录
Dim nm As String
Dim nm1 As String
Dim nm2 As String
Command9.Enabled = False
Command12.Enabled = True
Command13.Enabled = True

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。