Receiving a Null Value in a recordset

mjonesa1

New Member
Joined
Jan 11, 2016
Messages
1
I have a recordset that is returning a null value.

"strEvan = rstEVAN![F8]"

I would like to use a Message box to tell the user to select an alternative filter due to the null value.

How do I code for this?
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Dim strMsg as String 'goes in declarations section
Code:
If IsNull(strEvan) or strEvan = "" then
  strMsg = "No records exist for the chosen filter." & vbCrLf
  strMsg = strMsg & "Please select a different filter."
  msgbox strMsg 'set your message box title and button options here as well
  Exit Sub 'or function?
End If

Would it make more sense to convert the Null via Nz function?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,221,831
Messages
6,162,242
Members
451,756
Latest member
tommyw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top