Assign the IS NOT NULL to a variable

miguel vasquez

Registered User.
Local time
Today, 11:02
Joined
Nov 11, 2002
Messages
36
Anyone knows how to assign the a IS NOT NULL to a variable

strDept = "'is not null'" ******** THIS DOESN'T WORK **********
 
So you have a string variable and you want to set it to anything but null???
 
But this will! - strDept = "is not null"
How about explaining what you are trying to accomplish.
 
I have a drop down in my form, so when I select All in my department Name, I want to assign is not null to a variable, because I have a SQL statement based on my variables, see below...Thanks in advance


If Me.DeptName <> "All" Then
strDept = "'" & Me.DeptName & "'"

ElseIf Me.DeptName = "All" Then
strDept = "'is not null'"

End If

strSQL = "Select * into ReportTable from MainTable Where (type =" & strRPT & " or type =" & strRPT1 & ") and (DepartmentName =" & strDept & ")"
DoCmd.RunSQL strSQL
DoCmd.OpenTable "ReportTable", acNormal, acEdit
 
try setting strdept = "*", to see if that returns everything in your query?
 
I know that I need to assign a specific value to a variable. My question is can assign is not null to a variable. I am passing the value to a SQL statement.

I need help on this issue!!!!
 
There are other issues with your current structure. Why not just create different strSQL depending on the value of Me.DeptName?
 

Users who are viewing this thread

Back
Top Bottom