i would make your sub return a boolean. that boolean is determined on whether or not the dataset has data. then, when you call that function, you can display a message box if it returns false.