I have some contract text that may change.
It is currently (non live system) stored in a database field (we determine which contract text to get by using other fields in table). I, however need to display a specific date (based on individual contract) within this text.
IE (but Jan 12, changes depending on the individual contract):
blah blah blah... on Jan 12, 2009... blah blah blah
but everything else in the contract text is the same.
I'm looking for a way to inject the date into this text. Similar to .NET's
Console.Write("Some text here {0} and some more here", "My text to inject");
Is there something like this? Or am I going to need to split the text into two fields and just concatenate?
I am always displaying this information using Crystal Reports so if I can inject the data in through Crystal then that's fine.
I am using Crystal Reports, SqlServer 2005, and VB.net.
You could use some "reserved string" (such as the "{0}") as part of the contract, and then perform a replace after reading from the database.
If there's no option for this reserved string (for instance, if the contract may contain any type of string characters in any sequence, which I find unlikely), then you'll probably need to split into 2 text fields
Have you tried putting a text marker like the {0} above that can be replaced in the crystal reports code?
You can create a formula field and concatenate your text there.
If the data is stored in the database, the formula text should look like this:
"Some static text " & totext({yourRecord.yourDateField}, "yyyy")
Or you can provide it as a parameter before you show the report:
Dim parameterValue As New CrystalDecisions.Shared.ParameterDiscreteValue
value.Value = yourDate
Dim parameter As New CrystalDecisions.Shared.ParameterField
parameter.ParameterFieldName = "MyParam"
parameter.CurrentValues.Add(value)
parameter.HasCurrentValue = True
Me.CrystalReportViewer1.ReportSource = rapport
Me.CrystalReportViewer1.ParameterFieldInfo.Clear()
Me.CrystalReportViewer1.ParameterFieldInfo.Add(parameter)
Then the formula text should look like this:
"some static text " & {?MyParam}
I'm assuming you have a data source connected to your report. You can drag the field from the Database Explorer drop where it should appear. This way whenever the report runs the correct text will always be shown.
Related
I have a query that pulls information I need to use in a mail merge document to email to people for verification of information. There are 8 fields they need to verify, preferably with a check box control, but some of the fields contain no information. I would like to make the check box next to merge fields that contain no data (or whatever I may need to write into the query to make this work) invisible. If this could be accomplished easier in a completely different way, that would be fine too. Thank you.
As Cindy said, this kind of thing is handled via field coding in the mailmerge main document, not via VB code. Such a field might be coded as:
{IF{MERGEFIELD myCheck}<> "" "[ ]"}
or:
{IF«myCheck»<> "" "[ ]"}
where 'myCheck' is the field name and '[ ]' is the checkbox content control.
Note: The field brace pairs (i.e. '{ }') for the above examples are all created in the document itself, via Ctrl-F9 (Cmd-F9 on a Mac or, if you’re using a laptop, you might need to use Ctrl-Fn-F9); you can't simply type them or copy & paste them from this message. Nor is it practical to add them via any of the standard Word dialogues. Likewise, the chevrons (i.e. '« »') are part of the actual mergefields - which you can insert from the 'Insert Merge Field' dropdown (i.e. you can't type or copy & paste them from this message, either). The spaces represented in the field constructions are all required.
I'm having a strange situation:
I have a simple form with 2 text boxes.
The second one has the vba code triggered after being updated.
For example: typing value to the first field, ENTER, typing value into the second field, ENTER and the code starts.
The code, initially, takes the values from the text boxes and assign them to the string variables (pre declared as strings), like:
test1 = Me.frmSSN.Value
The problem is, the test1 variable seems to be empty after the line above.
It seems to happen only when I type, for example this string:
073QB8KJ2D00A4X
It works fine, when entering CNB0K2W5JK
The tool is a simple serial number comparison.
Just for test, I've entered this line into the code:
aaa="073QB8KJ2D00A4X"
When running in the step-by-step mode and hovering mouse over the "aaa" I'm getting: aaa= and then nothing.
Not even single "" like aaa="" or so. Just aaa=
After retrying multiple things - I believe it's about the value I enter:
073QB8KJ2D00A4X
Could be, that for access/vba it's some control string or so?
I'm just dumb now...
Thanks in advance for any help
Marek
p.s. Source fields are plain text boxes. And here's the code:
Dim user As String
Dim 1stSN As String
Dim 2ndSN As String
1stSN = Me.frmSSN.Value
2ndSN = Me.frmHPSN.Value
Then the values are being used as a part of SQL query. The problem is - in this situation - query doesn't work, as the sql string looks like:
"Select * From sbo_SerialSource where SN like " and nothing after "like".
Debug shows the correct value (with serial number), but query fails with "syntax error" message. Seems like there are some strange "control characters" are being created/added.
That's it.
And I have to use the serial numbers as these "strange ones", because that's how they come from the vendor.
I am working with 4 fields in Report Builder 3.0 in which I am trying to format as a number with the corresponding comma. When I use the number format in the Text Box Properties nothing happens. When I export this report to Excel the field has to be converted to a number as it is being exported as a text field.
Do you have any suggestions as to how I can change the formatting in the report itself?
Thanks for your time!
If I pull data from Oracle using an openquery I get the same issue. To resolve:
When you have the Text Box Properties box open, select the function key by the Value.
In the expression, add "Int" at the front of the string with () on each side of expression. (This converts the value of the expression to an integer)
Ex: =Int(Fields!Count.Value)
Close the expression box after making these additions and select "Numbering" in Text Box Properties to format the text box accordingly.
I just started using Access 2013 and there are two new data types, Short Text and Long Text. I need to programatically add a table in SQL and I used to use TEXT(100) or something like it, but what do I use to create a column of type Long Text? I need the field to be like the memo type in previous versions of Access, basically limitless or very large.
You can use Long Text just like the memo type:
In earlier version (before A2007) we had the RTF presentation for Memo
fields. The implementation was - IIRC - storing the text you had on
the screen in Word RTF format with some cryptic codes in {} to
indicate the formatting. In A2007 they changed to the new formatting
known as Rich Text. This is stored in the Memo field with HTML tags
implement the formatting. The thing they changed now is not the UI for
these fields but the name of the datatype in the database. It's not
called MEMO anymore, now it's called LONG TEXT. The formatted text
should AFAIK still be stored in the same way, as HTML coded text. When
you switch from plain text to rich text you do nothing else then tell
Access to use another UI to display the content of the data in the
database. Stored is still the same.
You can read more from here
Oops, I found it. It's just LONGTEXT.
http://msdn.microsoft.com/en-us/library/windows/desktop/ms714540(v=vs.85).aspx
I created a report in a VB.Net application and I'm using the Crystal Reports Viewer control to display it. The report is grouped by a field that's an integer datatype. I've been successful in formatting the field to a string so that it displays properly on the report (i.e., without any thousdand separators or decimals).
The problem now is that when I open the Group Tree in the viewer, the field is being treated as an integer (with the thousand separators). I've attempting following the solutions in these articles article1, article2, article3, but they only address formatting the display of the field (which I'm not having a problem with).
So how to I format the display of an integer as string on the Group Tree, not the report itself?
Go into the Group Expert, select your group, and hit "Options". Select the "Options" tab, and then mark the checkbox that says "Customize Group Name Field" and then select "Use Formula as Group Name" and finally enter the formula totext({table.field_you_are_grouping_on},0,'') This will change group's appearance everywhere, including in the tree.
Note that the second parameter to totext controls the number of decimals and the third parameter controls the thousands-separator (empty string, in our case).
Create a formula for the group like this:
ToText({table.field},0).
It will remove any thousands separators. I use this all the time.