What I want to do is add Parentheses around a field name in my access report, e.g., ([Wife]) with [Wife] being the field name.
What I want to do is add Parentheses around a field name in my access report, e.g., ([Wife]) with [Wife] being the field name.
You're going to need to elaborate further. A field name shouldn't have special characters such as parantheses. Is this just for display purposes? Can you show some screen shots?
Just use & in the source to concatenate whatever you want?
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
If this is really about the label in the report then no problem at all - it should work if you just enter (Wife) as the label caption. If the field name is Wife and it contains the value "Wife" then the field probably has the wrong name.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.
The Profile is about the size of a business card for each member. It has an image of the member in upper left corner. The first line has the members name which is input with the following: =Trim([Last] & ", " & [First] & " " & [MI])
The second line has the members' spouse name: [Wife] is the official field name. What I want to do is using the & and the ", put the Wife's name in Parentheses.
Below is the layout I want
John Doe
(Jane Doe) This is what I want to do in the report
Street address
Email ID
Occupation
In the source?, as I have already stated.
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
So you're not trying to add () around a field name. You're trying to surround the field values.
If done in the report design I think you'd have to hide the [Wife] control and add a calculated one wherein the controlsource property would be
="(" & NameOfWifeControl & ")"
However, I think the better approach is to calculate (concatenate) in the query behind the report and bind Wife control to the calculated field, which is what WGM is saying (I think). If your report is based on a table, then change it to a query. IMO all forms and reports should be based on queries and not tables anyway. You might want to use IIF to calculate that so you don't end up with () where there is no spouse.
EDIT - If you set the textbox to 0 height and use CanGrow property, you might be able to avoid a blank line where there is no spouse. Can't recall if that property works in print preview. Or have (no spouse) if there isn't one and you don't want a blank line in any case.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.
Your members are all heterosexual men?
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.
return (wife) only if the value isn't null or spaces.
Code:=IIf(Trim([Wife] & "")="","","(" & [Wife] & ")")
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
And some men refer to significant other as "husband". A gender neutral field name would be "Spouse" or "SigOther". Latter removes any scent of bias about gender, orientation, marital status. Shall we get into situation of multiple "SigOther" - any polygamists in the gallery?
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.