My text box is called "PgNum." If I change TbxPage to "PgNum," I get a Type Mismatch error. Run-time error '13'.
Me.PgNum.TextAlign = IIf(Me.PgNum Mod 2 = 0, "Left", "Right")
I tried
Me.PgNum.TextAlign = IIf(Me.Page Mod 2 = 0, "Left", "Right")
didn't work either.
In both cases, the default alignment (centered, 2) remained as the value for Me.PgNum.TextAlign.
I finally found a link to a very old book on VBA programming for Access 2003, and found the code that does what I want. I have 2 text boxes, txtPageEven and txtPageOdd. Odd formatted right justify and Even formatted left justify. I'd rather not have just one box spanning the entire footer.
The code in PageFooterSection_Format is:
Code:
If Me.Page Mod 2 = 0 Then
' Display Even page number on right side
Me.txtPageOdd.Visible = False
Me.txtPageEven.Visible = True
Else
' Display the Odd page number on left side
Me.txtPageOdd.Visible = True
Me.txtPageEven.Visible = False
End If
And this works perfectly.
Thanks for your help, and I hope this helps someone else along the way.