Loggerhead2000
Programmer
Hello,
My problem is when my VB 6.0 application queries my Access database (set up through Visual Data Manager). My SQL statement work fine, it find the record when it should and returns with nothing when it doesn't find a match. The problem I'm having happens when it's should return no records found, but insted of send back an empty recordset it sends back recordset of 1( I use Recount to get the number of records),and all it feilds are blank. I've tried using EOF and BOF but both indicate that there is a record in the recordset. I'v try Binding the Controls in the If stmt and out side doesn't have any effect on the outcome
[/i]
If adoPlay.EOF Then
Label9.Caption = "EOF "
Else
Label9.Caption = " not EOF "
End If
If adoPlay.BOF Then
Label9.Caption = "BOF"
Else
Label9.Caption = Label9.Caption & " not BOF"
End If
Label8.Caption = adoPlay.RecordCount
If adoPlay.BOF Or adoPlay.EOF Then
MsgBox "Could not find the song"
else
Set lblSong.DataSource = adoPlay
lblSong.DataField = "Song"
MsgBox "The Song selected was found"
End If
[/i]
I could store the recordset feilds in variable and check for "" but I thought there has to be a easier way then that. If anyone can suggest a fix to my problem that would be great
Thanks Timmeh
My problem is when my VB 6.0 application queries my Access database (set up through Visual Data Manager). My SQL statement work fine, it find the record when it should and returns with nothing when it doesn't find a match. The problem I'm having happens when it's should return no records found, but insted of send back an empty recordset it sends back recordset of 1( I use Recount to get the number of records),and all it feilds are blank. I've tried using EOF and BOF but both indicate that there is a record in the recordset. I'v try Binding the Controls in the If stmt and out side doesn't have any effect on the outcome
[/i]
If adoPlay.EOF Then
Label9.Caption = "EOF "
Else
Label9.Caption = " not EOF "
End If
If adoPlay.BOF Then
Label9.Caption = "BOF"
Else
Label9.Caption = Label9.Caption & " not BOF"
End If
Label8.Caption = adoPlay.RecordCount
If adoPlay.BOF Or adoPlay.EOF Then
MsgBox "Could not find the song"
else
Set lblSong.DataSource = adoPlay
lblSong.DataField = "Song"
MsgBox "The Song selected was found"
End If
[/i]
I could store the recordset feilds in variable and check for "" but I thought there has to be a easier way then that. If anyone can suggest a fix to my problem that would be great
Thanks Timmeh