Skip to content

Commit f8d1f22

Browse files
Use Nz() for string assignments from data fields
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
1 parent a19e5ca commit f8d1f22

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Version Control.accda.src/modules/clsDbSharedImage.cls

+3-3
Original file line numberDiff line numberDiff line change
@@ -704,12 +704,12 @@ Private Property Set IDbComponent_DbObject(ByVal RHS As Object)
704704
Set m_Rst = RHS
705705

706706
' Load in the object details.
707-
m_Name = m_Rst!Name
708-
m_Extension = m_Rst!Extension
707+
m_Name = Nz(m_Rst!Name)
708+
m_Extension = Nz(m_Rst!Extension)
709709
'@Ignore SetAssignmentWithIncompatibleObjectType
710710
Set fld2 = m_Rst!Data
711711
Set rst2 = fld2.Value
712-
m_FileName = rst2.Fields("FileName")
712+
m_FileName = Nz(rst2.Fields("FileName"))
713713
m_FileData = rst2.Fields("FileData")
714714

715715
' Clear the object references

Version Control.accda.src/modules/clsDbTheme.cls

+3-3
Original file line numberDiff line numberDiff line change
@@ -667,12 +667,12 @@ Private Property Set IDbComponent_DbObject(ByVal RHS As Object)
667667
Set m_Rst = RHS
668668

669669
' Load in the object details.
670-
m_Name = m_Rst!Name
671-
m_Extension = m_Rst!Extension
670+
m_Name = Nz(rst!Name)
671+
m_Extension = Nz(rst!Extension)
672672
'@Ignore SetAssignmentWithIncompatibleObjectType
673673
Set fld2 = m_Rst!Data
674674
Set rst2 = fld2.Value
675-
m_FileName = rst2.Fields("FileName")
675+
m_FileName = Nz(rst2.Fields("FileName"))
676676
m_FileData = rst2.Fields("FileData")
677677

678678
' Clear the object references

0 commit comments

Comments
 (0)