Skip to content

Commit

Permalink
Use Nz() for string assignments from data fields
Browse files Browse the repository at this point in the history
Best practice is to never assume a field will contain a string value, but use the Nz function to handle the possibility of null values. Fixes #408
  • Loading branch information
joyfullservice committed Jul 5, 2023
1 parent a19e5ca commit f8d1f22
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Version Control.accda.src/modules/clsDbSharedImage.cls
Expand Up @@ -704,12 +704,12 @@ Private Property Set IDbComponent_DbObject(ByVal RHS As Object)
Set m_Rst = RHS

' Load in the object details.
m_Name = m_Rst!Name
m_Extension = m_Rst!Extension
m_Name = Nz(m_Rst!Name)
m_Extension = Nz(m_Rst!Extension)
'@Ignore SetAssignmentWithIncompatibleObjectType
Set fld2 = m_Rst!Data
Set rst2 = fld2.Value
m_FileName = rst2.Fields("FileName")
m_FileName = Nz(rst2.Fields("FileName"))
m_FileData = rst2.Fields("FileData")

' Clear the object references
Expand Down
6 changes: 3 additions & 3 deletions Version Control.accda.src/modules/clsDbTheme.cls
Expand Up @@ -667,12 +667,12 @@ Private Property Set IDbComponent_DbObject(ByVal RHS As Object)
Set m_Rst = RHS

' Load in the object details.
m_Name = m_Rst!Name
m_Extension = m_Rst!Extension
m_Name = Nz(rst!Name)
m_Extension = Nz(rst!Extension)

This comment has been minimized.

Copy link
@monheimx9

monheimx9 Jul 6, 2023

m_Name = Nz(m_Rst!Name)
m_Extension = Nz(m_Rst!Extension)
;^)

'@Ignore SetAssignmentWithIncompatibleObjectType
Set fld2 = m_Rst!Data
Set rst2 = fld2.Value
m_FileName = rst2.Fields("FileName")
m_FileName = Nz(rst2.Fields("FileName"))
m_FileData = rst2.Fields("FileData")

' Clear the object references
Expand Down

0 comments on commit f8d1f22

Please sign in to comment.