Use variables; do your logical comparisons (Iif) when you set the value of the variables. Do your concatenating and formatting where you set the display value for the control. This works:
Code:
Option Explicit
Public Sub Command1_Click()
Dim a As Integer
Dim b As String
a = IIf(DSum("[Count]", "test1") = Null, 0, DSum("[Count]", "test1"))
b = IIf(DSum("[Count]", "test1") = Null, 0, (DSum("[Count]", "test1") / DSum("[total]", "test1")))
Text5.SetFocus
Text5.Text = a & " | " & Format(b, "Percent")
End Sub
I've attached a screen print showing the test data and the result. Hope this helps.