请教,我的数据库为何不能运行?
为了彩票,我编来个双色球数据库(DAO),其实基本上是抄书,一运行,第一行就被提示错误:“自定义数据未被定义”很痛苦,不知道错在哪?求教高手指点。先谢过了!码复制如下:
Dim ss As Database
Dim hl As Recordset
Private Function showtext()
Text1.Text = hl.Fields("序号")
Text2.Text = hl.Fields("公号")
Text3.Text = hl.Fields("日期")
Text4.Text = hl.Fields("h1")
Text5.Text = hl.Fields("h2")
Text6.Text = hl.Fields("h3")
Text7.Text = hl.Fields("h4")
Text8.Text = hl.Fields("h5")
Text9.Text = hl.Fields("h3")
Text10.Text = hl.Fields("lan")
End Function
Private Sub Command2_Click()
hl.Edit
hl.Fields("序号") = Text1.Text
hl.Fields("公号") = Text2.Text
hl.Fields("日期") = Text3.Text
hl.Fields("h1") = Text4.Text
hl.Fields("h2") = Text5.Text
hl.Fields("h3") = Text6.Text
hl.Fields("h4") = Text7.Text
hl.Fields("h5") = Text8.Text
hl.Fields("h6") = Text9.Text
hl.Fields("lan") = Text10.Text
hl.Update
MsgBox "修改数据成功!"
End Sub
Private Sub Command3_Click()
hl.MoveNext
If hl.EOF Then
MsgBox "已到最后一个记录"
Else
Call showtext
End If
End Sub
Private Sub Command4_Click()
hl.selete
MsgBox "删除数据成功!"
End Sub
Private Sub Command5_Click()
hl.MoveFirst
Call showtext
End Sub
Private Sub Command6_Click()
hl.MovePrevious
If hl.BOF Then
MsgBox "以到第一个记录"
Else
Call showtext
End If
End Sub
Private Sub Command7_Click()
hl.MoveLast
Call showtext
End Sub
Private Sub Form_Load()
Set ss = OpenDatabase("f:/双色库.mdb")
Set hl = 双色库.OpenRecordset("hl")
Call showtext
End Sub
Private Sub Command1_Click()
hl.AddNew
hl.Fields("序号") = Text1.Text
hl.Fields("公号") = Text2.Text
hl.Fields("日期") = Text3.Text
hl.Fields("h1") = Text4.Text
hl.Fields("h2") = Text5.Text
hl.Fields("h3") = Text6.Text
hl.Fields("h4") = Text7.Text
hl.Fields("h5") = Text8.Text
hl.Fields("h6") = Text9.Text
hl.Fields("lan") = Text10.Text
hl.Update
MsgBox "增加数据成功!"
End Sub