实时错误'3001' 参数类型不下确,或不在可以接受的范围之内,或与其它参数冲突!
Const BlockSize = 100000Dim NumBlocks As Integer
Dim FileLength As Long
Dim LeftOver As Long
Dim i As Integer
Dim n As Integer
Dim ByteDate() As Byte
Dim FileName As String
Dim FileNum As Integer
Dim DiskFile As String
Private Sub Form_Load()
recs = Adodc1.Recordset.RecordCount
DiskFile = App.Path & "\image1.bmp"
End Sub
Private Sub Form_Activate()
DataGrid1.SetFocus
Call encomm
End Sub
Private Sub Comm1_Click()
Dim Num1 As String
Num1 = Adodc1.Recordset.Fields("报名号") '不能用DataGrid导航,应使用Find方法指向修改的记录
Adodc1.Recordset.MoveLast
Adodc1.Recordset.Find ("报名号'" & Num1 & "'") '这行有误
sel = False
If Adodc1.Recordset.Fields("照片长度") > 0 Then
'将当前记录的照片数据存放在临时文件image1.bmp中
sel = True
Me.MousePointer = vbHourglass
FileLength = Adodc1.Recordset("照片长度")
If FileLength > 10000 Then
n = 5
Else
n = 10
End If
If Len(Dir$(DiskFile)) > 0 Then
Kill DiskFile '删除原来存在的临时文件
End If
FileNum = FreeFile()
Open DiskFile For Binary Access Write As FileNum '打开文件
NumBlocks = FileLength \ (BlockSize \ n)
LeftOver = FileLength Mod (BlockSize \ n) '余下的长度
ReDim ByteData(BlockSize \ n)
For i = 1 To NumBlocks
ByteData() = Adodc1.Recordset("照片").GetChunk(BlockSize \ n)
Put FileNum, , ByteData
Next i
If LeftOver > 0 Then
ReDim ByteData(LeftOver)
ByteData() = Adodc1.Recordset("照片").GetChunk(LeftOver)
Put FileNum, , ByteData
End If
Close FileNum '关闭文件
Me.MousePointer = vbNormal
End If
quks1.PrintForm
Unload quks1
End Sub
Private Sub Comm2_Click() '返回
Unload Me
End Sub
Private Sub selcmd1_click() '确定
If Trim(Text1(1).Text) <> "" Then
If Not IsDate(Trim(Text1(1).Text)) Then
MsgBox "出生日期输入错误,应为yyyy-mm-dd类型", vbOKOnly, "信息提示"
Text1(1).SetFocus
Exit Sub
End If
End If
condstr = "" '以下根据用户输入的数据构造条件表达式
If Trim(Text1(0).Text) <> "" Then
If condstr = "" Then
condstr = "姓名 like '" + Trim(Text1(0).Text) + "'"
Else
condstr = condstr + " and 姓名 like '" + Trim(Text1(0).Text) + "'"
End If
End If
If Trim(Text1(1).Text) <> "" Then
If condstr = "" Then
condstr = "出生日期='" + Format(Trim(Text1(1).Text), "yyyy.mm.dd") + "'"
Else
condstr = condstr + " and 出生日期='" + Format(Trim(Text1(1).Text), _
"yyyy.mm.dd") + "'"
End If
End If
If Trim(Text1(2).Text) <> "" Then
If condstr = "" Then
condstr = "通信地址 like '" + Trim(Text1(2).Text) + "'"
Else
condstr = condstr + " and 通信地址 like'" + Trim(Text1(2).Text) + "'"
End If
End If
If Opt1.Value = True Then
If condstr = "" Then
condstr = "性别='男'"
Else
condstr = condstr + " and 性别='男'"
End If
ElseIf Opt2.Value = True Then
If condstr = "" Then
condstr = "性别='女'"
Else
condstr = condstr + " and 性别='女'"
End If
End If
If condstr <> "" Then '有条件查找
Adodc1.RecordSource = "select * from ksb where " + condstr
Adodc1.Refresh
Else '无条件查找
Adodc1.RecordSource = "select * from ksb"
Adodc1.Refresh
End If
recs = Adodc1.Recordset.RecordCount
If recs = 0 Then
MsgBox "没有任何满足条件的记录", vbOKOnly, "信息提示"
End If
Call encomm
End Sub
Private Sub selcmd2_click() '重置
Text1(0).Text = ""
Text1(1).Text = ""
Text1(2).Text = ""
Opt1.Value = False
Opt2.Value = False
End Sub
Private Sub encomm() '自定义子过程,判断Adodc1中是否存在记录
If recs = 0 Then
Comm1.Enabled = False
Else
Comm1.Enabled = True
End If
End Sub
Private Sub text1_KeyPress(Index As Integer, KeyAscii As Integer)
Call endata(KeyAscii)
End Sub
--------------------编程问答-------------------- 哪一句报错? --------------------编程问答-------------------- Adodc1.Recordset.Find ("报名号='" & Num1 & "'")
补充:VB , 数据库(包含打印,安装,报表)