Duane Hookom said:
I would use the Print method in code to do this. For instance, I bound the
LastName field to a text box in the detail section of a report. Make the
text box invisible and position it about where you want your first
character to print. The following code will print each character from the
last name 1/4" apart. You can adjust the font size, font face, intSpacing,
etc to meet your needs.
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim strLastName As String
Dim intTop As Integer
Dim intSpacing As Integer
Dim intCharacter As Integer
Dim intLeftMost As Integer
intSpacing = 1440 / 4 '1/4 inch
strLastName = Me.LastName
Me.FontSize = 16
intLeftMost = Me.LastName.Left
intTop = Me.LastName.Top
For intCharacter = 1 To Len(strLastName)
Me.CurrentX = intLeftMost + (intCharacter - 1) * intSpacing
Me.CurrentY = intTop
Me.Print Mid(strLastName, intCharacter, 1)
Next
End Sub
I ran into an error.
At the first Me.NameDL I get "method or data member not found"
and ".NameDL" is highlighted. I guess the field name can't be found.
I am not sure where to put this code. I tried in the report and Query
event procedures.
Here is the code
Private Sub Command404_Click()
'Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim strLastName As String
Dim intTop As Integer
Dim intSpacing As Integer
Dim intCharacter As Integer
Dim intLeftMost As Integer
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("qryAnswerSheets", dbOpenDynaset)
counter = 0
Maxrecs = DCount("*", "qryAnswerSheets")
If IsNull(Maxrecs) Then
GoTo Error1
End If
DoCmd.GoToRecord acDataQuery, "qryAnswerSheets", acFirst
Do
counter = counter + 1
DoCmd.OpenReport "rptAnswerSheets", acViewPreview
'DoCmd.OpenQuery "qryAnswerSheets"
'NameDL.SetFocus
intSpacing = 1440 / 4 '1/4 inch
strLastName = Me.NameDL
Me.FontSize = 16
intLeftMost = Me.NameDL.Left
intTop = Me.NameDL.Top
For intCharacter = 1 To Len(strLastName)
Me.CurrentX = intLeftMost + (intCharacter - 1) * intSpacing
Me.CurrentY = intTop
Me.Print Mid(strLastName, intCharacter, 1)
Next
DoCmd.GoToRecord acDataQuery, "qryAnswerSheets", acNext
Loop Until counter = Maxrecs
GoTo Exit2
Error1:
End Sub