I need to put aditional characters in a report field (1 Viewer)

ckhatch

New member
Local time
Today, 12:41
Joined
Feb 11, 2001
Messages
9
I need to have a field in a report that prints out its data with a " * " on either side
Something like this in the fields record source ="*" & [Field in select query] & "*"
but this doesn't work any suggestions ?
I cant use text labels on either side because I need the * next to the beginning and ending characters
 

RedSkies

Registered User.
Local time
Today, 06:41
Joined
Aug 17, 2000
Messages
48
Here's the only way I got it to work.
Include your actual field somewhere on the report but set its Visible property to No. Then put an unbound control where you would have placed your actual field on the report.

In the report Detail event:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim strAsteriskEnclosedField As String
strAsteriskEnclosedField = Me![YourActualFieldName]
strAsteriskEnclosedField = "*" & strAsteriskEnclosedField & "*"
Me![YourUnboundFieldName] = strAsteriskEnclosedField
End Sub
 

Jon Holmes

Banned
Local time
Today, 12:41
Joined
May 16, 2001
Messages
25
Sounds like your control has the same name as the field it is bound to. Access does this by default. Place a prefix on your textbox name such as txt_Field and leave your control source as ="*" & Field & "*".
This should work.
Also if you have a field that has the same name as a report attribute (a common field name is "Name") then you will experience problems adding information to it. For example having a control source ="Name: " & [Name] will print the Report name and not the field name. To get around this, type the table and field name inside the square brackets eg. ="Name: " & [tbl_Names.Name]
This will print what you intuitively want to print.

Jon
 

Users who are viewing this thread

Top Bottom