|
-
February 9th, 2011, 05:55 AM
#1
runtime error 3021
runtime error 3021 (either BOF or EOF is true, or the current record
has been deleted. requested operation requires a current record)
heres my code
Code:
Dim rs As ADODB.Recordset
Dim bData() As Byte
Private Sub Form_Load()
MSComm1.PortOpen = True
connect
Set rs = New ADODB.Recordset
rs.Source = "Users"
rs.ActiveConnection = cn
rs.CursorLocation = adUseClient
rs.LockType = adLockOptimistic
rs.Open
End Sub
Private Sub showRecord()
If rs.EOF Or rs.BOF Then Exit Sub
ReDim bData(rs.Fields("photo").ActualSize)
bData = rs.Fields("photo").Value
szfile = App.Path & "\tempPic.tmp"
Open szfile For Binary Access Write As #1
Put #1, , bData
Close #1
Image1.Picture = LoadPicture(szfile)
Label1.Caption = rs.Fields("Studentno")
Label3.Caption = rs.Fields("Surname")
Label4.Caption = rs.Fields("Firstname")
Label5.Caption = rs.Fields("Middlename")
Label6.Caption = rs.Fields("College")
Label7.Caption = rs.Fields("Course")
Label8.Caption = rs.Fields("Yrsec")
End Sub
Private Sub MSComm1_OnComm()
Text1.Text = Clear
Dim strinput As String
strinput = MSComm1.Input
Text1.Text = Text1.Text & strinput
Label9.Caption = Format$(Now, "m/d/yy h:mm Am/Pm")
End Sub
Private Sub Text1_Change()
Dim strSQL As String
rs.Close
strSQL = "SELECT * "
strSQL = strSQL & "FROM users "
strSQL = strSQL & "WHERE Rfid = '" & Text1.Text & "'"
rs.Open strSQL, GetConnString, adOpenForwardOnly, adLockReadOnly
If Text1.Text = rs.Fields("Rfid") Then <----- error is here
showRecord
Else
Form1.Show
End If
End Sub
Private Function GetConnString() As String
GetConnString = "Provider=Microsoft.jet.oledb.4.0;Data Source=" & App.Path & "\RegID.mdb"
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|