Another point of view
Instead of Nullable, you can handle this using Optional
If you define it as Optional BLABLA As Integer , it will have a default value of 0 , so if its null or empty u will have a default value of 0 ..
Here is an example I made for myself! This may come in handy:
Application:
ProgressInc ProgressBar1 'you can add other options if you want as shown below 'ProgressInc ProgressBar1, 500, 50, 25, True 'I always change Min value to 1 in my ProgressInc so if you even choose it as 0 it still gonna be 1
also works this way
Dim TheThing As Long ProgressInc ProgressBar1 ,TheThing 'See no definition about TheThing except being Long type 'cause of this its value is 0
Sub:
Public Sub ProgressInc(ProgressBarName As ProgressBar, Optional Max As Long, Optional Min As Long, Optional Inc As Long, Optional Continues As Boolean = False) Dim Recent As Long On Err GoTo ProgressBarErr ProgressBarName.ShowWhatsThis DoEvents 'Maximum ProgressBar Value If Max <> 0 Then ProgressBarName.Max = Max Else Max = 100 ProgressBarName.Max = Max End If 'Minimum ProgressBar Value If Min <> 0 Then ProgressBarName.Min = Min Else Min = 1 ProgressBarName.Min = Min End If If Inc <> 0 Then Inc = Inc Else Inc = 1 'When the ProgressBar value is at Maximum 'Return to the Minimum value If Continues = True And ProgressBarName.Value = Max Then ProgressBarName.Value = Min End If 'Checkout Recent progress (pre calculate bar value) Recent = ProgressBarName.Value + Inc If Recent >= Max Then 'Recent value is higher than or equals to Max value 'to avoid errors caused by this issue Value should equal to Max ProgressBarName.Value = Max ElseIf Recent < Max Then 'Recent(pre calculated bar value) is lower than Max 'So nothing wrong here, proceed.. ProgressBarName.Value = ProgressBarName.Value + Inc End If Exit Sub ProgressBarErr: 'ProgressBar error report. MsgBox "With " & Err.Number & " number : '" & Err.Description & "' error occured. " End Sub
see im there, getting Min, Max, Inc As Long , and when I don't define them, they have 0 as the default value.
source share