View Full Version : How to search an SQL Table


jane2007
03-13-2007, 07:10 AM
Hello,

Here is my current code ...

Dim rstStk As Recordset
Set rstStk = CurrentDb.OpenRecordset("Select * from stk where PartNum = '" & strPrt & "'")

The problem with this code is that i get a run time error if no record is found. How can i search the table differently where i can add a conditional statement so if no record is found, my code can do sometime else.

I really do need help. Thanks.

Dennisk
03-13-2007, 07:54 AM
are you testing for End of file

immediatly after then open method place then following code

if not rstStk.EOF then
... your code here
endif