Access 2016 VBA如果Applyfilter为null,如何跳过

时间:2016-09-13 15:33:59

标签: access-vba ms-office access isnull

如果值为null,我试图让这段代码跳到另一行。这是脚本的SHORTENED版本。

Ok(attivita)

如果它尝试应用的过滤器不在报告中,我希望它转到DoCmd.ShowAllRecords行。

感谢任何帮助

1 个答案:

答案 0 :(得分:0)

试试这个:

For Counter =1 to 10 
     If Dcount("*",[add here the recordsource],"Name like '" & "*" & DoctorsName & "*" & "'" ) > 0 THEN 
        DoCmd.ApplyFilter , "Name like '" & "*" & DoctorsName & "*" & "'"  
        DoCmd.OutputTo acSendReport, "", acFormatPDF, "C:Directory\Title.pdf" 
     End If
     DoCmd.ShowAllRecords 
Next Counter