Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / January 2005

Tip: Looking for answers? Try searching our database.

Catching the Null Value

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mark B. - 31 Jan 2005 20:57 GMT
Hi

I’m trying to set a record set to my variables.  In doing so I get an error
when there is a null value in the table.  I’m trying to catch the null values
with the if then statement with no luck.  Here is some of my code:

Dim strNewBankerName As String
Dim strSQL As String
Dim rst As Recordset
Dim dbs As Database

Set dbs = CurrentDb

strSQL = "SELECT Relationship_ID, Banker_ID, NewBankerID,
NewBankerIntranetID, NewBankerName FROM BankerReassignmentList;"

Set rst = dbs.OpenRecordset(strSQL)
rst.MoveFirst

       If rst("NewBankerName") = Null Then
            MsgBox "rst('NewBankerName') is Null"
       Else
           strNewBankerName = rst("NewBankerName")
     
       End If

What can I do to catch the Null?

Thanks in advance,

Mark
T Martin - 31 Jan 2005 21:11 GMT
If isnull(rst!NewBankerName) = true then
msgbox "rst('NewBankerName') is null
Else
strNewBankerName = rst("NewBankerName")
End if

> Hi
>
> I'm trying to set a record set to my variables.  In doing so I get an
error
> when there is a null value in the table.  I'm trying to catch the null
values
> with the if then statement with no luck.  Here is some of my code:
>
[quoted text clipped - 23 lines]
>
> Mark
Mark B - 31 Jan 2005 21:25 GMT
It works, Thanks T Martin

Mark

> If isnull(rst!NewBankerName) = true then
> msgbox "rst('NewBankerName') is null
[quoted text clipped - 35 lines]
> >
> > Mark
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.