pages with letters

G

Guest

I want print pages of a report as follows 1, 1A, 1B, 1C

Right now I have a unbound text box (named text10) in the page footer next
to "Page 1" and have written a OnFormat event procedure as follows:
If Page = 1 Then
Text10 = "" gives me "Page 1"
End If
If Page = 2 Then
Text10 = "A" gives me "Page 1A"
End If
If Page = 3 Then
Text10 = "B" gives me "Page 1B"
End If
If Page = 4 Then
Text10 = "C" gives me "Page 1C"
End If

Is there a better way of doing this without all the if statements? I'm new
to VBA Code writing
 
K

Ken Snell [MVP]

Don't know if it's better, but this is more compact:

Text10 = "Page 1" & Choose([Page], "", "A", "B", "C")
 
M

Marshall Barton

ESVAnandog said:
I want print pages of a report as follows 1, 1A, 1B, 1C

Right now I have a unbound text box (named text10) in the page footer next
to "Page 1" and have written a OnFormat event procedure as follows:
If Page = 1 Then
Text10 = "" gives me "Page 1"
End If
If Page = 2 Then
Text10 = "A" gives me "Page 1A"
End If
If Page = 3 Then
Text10 = "B" gives me "Page 1B"
End If
If Page = 4 Then
Text10 = "C" gives me "Page 1C"
End If

Is there a better way of doing this without all the if statements? I'm new
to VBA Code writing


You don't need any VBA code for this. Set the text box's
control source expression to:

="1" & IIf([Page]>1, Chr(63 + [Page]), "")
 
G

Guest

Thanks. It does work. It's my fault I should have stated that I wanted an
automatic code or formula without input from me.

ESVAnandog

Ken Snell said:
Don't know if it's better, but this is more compact:

Text10 = "Page 1" & Choose([Page], "", "A", "B", "C")


--

Ken Snell
<MS ACCESS MVP>


ESVAnandog said:
I want print pages of a report as follows 1, 1A, 1B, 1C

Right now I have a unbound text box (named text10) in the page footer next
to "Page 1" and have written a OnFormat event procedure as follows:
If Page = 1 Then
Text10 = "" gives me "Page 1"
End If
If Page = 2 Then
Text10 = "A" gives me "Page 1A"
End If
If Page = 3 Then
Text10 = "B" gives me "Page 1B"
End If
If Page = 4 Then
Text10 = "C" gives me "Page 1C"
End If

Is there a better way of doing this without all the if statements? I'm
new
to VBA Code writing
 
G

Guest

Thanks it works great. This is what a I wanted. The report I wanted this
formula for, the pages probably won't go beyound approx "1H".

ESVAnandog

Marshall Barton said:
ESVAnandog said:
I want print pages of a report as follows 1, 1A, 1B, 1C

Right now I have a unbound text box (named text10) in the page footer next
to "Page 1" and have written a OnFormat event procedure as follows:
If Page = 1 Then
Text10 = "" gives me "Page 1"
End If
If Page = 2 Then
Text10 = "A" gives me "Page 1A"
End If
If Page = 3 Then
Text10 = "B" gives me "Page 1B"
End If
If Page = 4 Then
Text10 = "C" gives me "Page 1C"
End If

Is there a better way of doing this without all the if statements? I'm new
to VBA Code writing


You don't need any VBA code for this. Set the text box's
control source expression to:

="1" & IIf([Page]>1, Chr(63 + [Page]), "")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top