Change the name of Page N of M in Crystal Report - sap

​Hi,
I am creating a total quantity label statement in Crystal. I am using the Special Field Page N of M in my Details section
Is there a way to remove the text "Page" so that it will just display 1/2" in place instead of "Page 1/2"
Thanks,

The Special Field can't be modified, but you can create a formula to get the desired output:
CStr(PageNumber, "#") & "/" & CStr(TotalPageCount, "#")

Related

Crystal report - Display page number as 1 of 2 and 2 of 2 and so on

I need to display the page number in the crystal report as
1 of 2
2 of 2 ......
and so on
I tried many ways but it didn't work out
Please help me on this
Simply drag 'Page N of M' from the list under 'Special Fields' in field explorer onto the report canvas.
In that case, create and use this formula to display the desired result:
ToText(PageNumber,0) & " of " & ToText(TotalPageCount,0)

Filter as you type combo box me.recordsource

I can upload a file if someone tells me how.
Need help replicating a filter as you type on a combo box that is being used at the record level. Example: Instead of having an open text box for the prefix (e.g. Mr. Mrs. Ms. Dr.), I'm using a combo box that looks up from a reference table. I want to be able to type the letter "r" in the combo box and have it filter out Ms. and showing the remaining values. Once I make a selection store the selected value in the Name table.
Issue: When I add a new value in Combo4 the other rows above clear out if they don't match the value I just typed into the cell. Something likely with the RowSource in the below formula. Do I have something out of sequence or a flawed formula?
What I think I'm trying to do:
1) If Prefix value populated w/ value in t_Name THEN show the matching value in t_ref_Prefix
2) If Combo4 is Blank / Null THEN then open Combo4 and show all values in t_ref_Prefix so a value can be selected.
3) If user is typing text into Combo4 THEN filter on change using * on both sides of the typed value.
Option Compare Database
Option Explicit
Private Sub Combo4_Change()
'https://stackoverflow.com/questions/48133260/display-records-in-access-db-combobox-on-any-text-typed-by-user
'test number of characters entered - if greater then 0 then assign rowsource
If Len(Me.Combo4.Text) > 0 Then
'set the rowsource to match user search criteria
Me.Combo4.RowSource = "SELECT * FROM t_ref_Prefix WHERE Prefix LIKE '*" & Me.Combo4.Text & "*'"
'show the search in real-time
Me.Combo4.Dropdown
Else
'set to no
Me.Combo4.RowSource = "SELECT t_ref_Prefix.auto, t_ref_Prefix.prefix, t_ref_Prefix.sort FROM _
t_ref_Prefix ORDER BY t_ref_Prefix.sort, t_ref_Prefix.prefix"
End If
End Sub
You need to set
Combo4.AutoExpand = False
This will do it.

Mix text and data to make a paragraph in Access

I am working on a MS Access 2010 database where users proceed through several form pages of data entry and then are given the option to print a narrative report of the findings.
Some pages of the report have thing such as a text box that reads "Number of Widget A Sold:" and then next to it a Field for WidgetASold which is fine for that section. However, for one of the reports I would like this information integrated into a paragraph of text such as:-
In this fiscal year we sold WidgetASold units of Widget A and WidgetBSold units of Widget B.
I have tried using VBA:-
Dim a As String
Dim b As String
Dim c As String
Dim d As String
Dim WidgetASold As String
Dim WidgetBSold As String
a = "In this fiscal year we sold "
b = " units of Widget A and "
c = " units of Widget B"
d = a & WidgetASold & b & WidgetBSold & c
Which I honestly don't even know if it is a good way to go about things. I have also considered having the text in its own table but I still wouldn't know how to get five fields to line up together in one paragraph.
Basically what I am looking for is the access equivalent of excel's
=CONCATENATE("Some text ",B2," more text ",B12," last text.")
Thank you in advance for your assistance.
To do this, you use an expression as control source of a text box:
= "In this fiscal year we sold " & [WidgetASold] & " units of Widget A and " & [WidgetBSold] & " units of Widget B."
This assumes that WidgetASold and WidgetBSold are included in the record source of the report.
You could do it with VBA in the On Format event of the section, but there is really no reason to do so.

How to pass "Month" and "Year" Only parameter from datetimepicker to crystal report?

Good morning, i am struggling with this Crystal report problem, i have the formula on my report :
cstr(monthname(month({kwitansi1.tgl_kwitansi})))+" - " +cstr(year({kwitansi1.tgl_kwitansi}),0)
It is working and showing the data that i want, which is like this :
May-2015 $1000
June-2015 $600
July-2015 $250
August-2015 $1500
And i have 2 parameter, "?month1" and "?Month2", when i preview it say the field name is not known.
Those parameters is for datetimepicker1 and datetimepicker2.
So basically i want to show, for example:
if i click on datetimepicker1 then fill it with some random date but Month is May-2015 and then i click datetimepicker2 fill it with random date too but Month is August-2015, and then i click "print" button, the crystal report should show those data above that i want.
I am using this on vb.form to pass the parameters to Crystal Report.
objrepdoc = New CRLaporanPendapatanPerbulan
objrepdoc.SetParameterValue("month1", Format(FormCetakLaporanPendapatan.datetimepicker1.Value, "MMMM-YYYY"))
objrepdoc.SetParameterValue("month2", Format(FormCetakLaporanPendapatan.datetimepicker2.Value, "MMMM-YYYY"))
objrepdoc.RecordSelectionFormula = "{kwitansi1.tgl_kwitansi} >= #" & Format(FormCetakLaporanPendapatan.datetimepicker1.Value, "MMMM-YYYY") & "# And {kwitansi1.tgl_kwitansi} <= #" & Format(FormCetakLaporanPendapatan.datetimepicker2.Value, "MMMM-YYYY") & "#"
I know those codes is wrong, :( because if i chose any month, the crystal report show all the data that has been saved on the date (kwitansi1.tgl_kwitansi) field. What i want is the CR is to show only specified data that VB.Form send using datetimepicker1 and datetimepicker2
Since there's no one answer my question, i will answer this for reference of other people that have the same problem.
So, the easy part is actually:
Make 2 parameters, first for the starting parameter and second for the ending parameter, basically we will make an "In between" code.
After that, right click on the print area (everywhere) and click Report> selection formula > Record > The dialog showed up > copy-paste this {tableA.date_table} in {?parameter1} to {?parameter2}
Save them
On the windows form use this:
Make 2 datetimepicker
Copy-paste this on form:
Dim objrepdoc As New ReportDocument
`objrepdoc = New CrystalReport1
objrepdoc.SetParameterValue("parameter1", Format(Form1.DTdate1.Value, "yyyy-MM-dd"))
objrepdoc.SetParameterValue("parameter2", Format(Form1.DTdate2.Value, "yyyy-MM-dd"))
objrepdoc.RecordSelectionFormula = "{tableA.date_table} >= #" & Format(Form1.DTdate1.Value, "yyyy-MM-dd") & "# And {tableA.date_table} <= #" & Format(Form1.DTdate2.Value, "yyyy-MM-dd") & "#"`
NOTE: The datetimepicker may show the date as well , you can modify it so that datetimepicker shows only month and Year.

MS Access multi field search with empty fields or multiple selections from list boxes

can some one kindly help me with MS Access? My problem is similar to the one in the following link:
MS Access multi field search with empty fields
but in my case, each search field is a list box from which we can select multiple things.
In my case, the user of the database application will enter start date and end date (text boxes) which will populate the list boxes (cost center, item number, employee id) from a single database table matching the rows that have effective date falling between start date and end date. After populating the list boxes, the user has the choice to either select multiple cost centers or leave the search field blank, multiple item numbers or blank, multiple employee numbers or blank. After selecting, if the command button display results is pressed, we should be able to get the results which satisfy all these search criteria. For example, if I select cost centers 1301, 1302 and employee no.s 492128, 492690, 492959 and leave the item numbers search field blank, then in the data table, all the entries that match these cost centers and employee no.s (all the search fields are separate columns) which fall between the start date and end date should be displayed.
I am unable to get the logic in VB. Please guide me through.
You'll need to build up an sql statement in vba then run it using a recordset, to get the results back.
Obviously I dont know what the data you'll need to get is, or from the tables you;ll get it from, however the where clause needs to be built as follows:
dim wc as string
wc = wc & iif(lst_costcenter.ItemsSelected.Count = 0, "", " AND " & InClause(lst_costcenter, "tablename.columnname", false))
wc = wc & iif(lst_itemnumber.ItemsSelected.Count = 0, "", " AND " & InClause( ...
Finally when building the sql statement, you'll need to chop of the first "AND" in wc & replace it with "WHERE"
wc = iif(wc <> "", " WHERE " & mid(trim(wc), 5), "")
InClause is a function that you need to add in a module, or in the enquiry form itself:
It uses 3 arguments:
1. The listbox control to build an in clause for,
2. A string comprising tablename-dot-columnname being the table/column to be filtered for the values selected in the listbox, &
3. True/False according to whether the datatype of the column is string (true) or numeric (false)
Public Function InClause(lst as ListBox, tblcol as string, isAlpha as boolean)
Dim si As String
Dim vv As Variant
For Each vv In lstBox.ItemsSelected
If isAlpha Then
si = si & "," & Chr(34) & lstBox.Column(0, vv) & Chr(34)
Else
si = si & "," & lstBox.Column(0, vv)
End If
Next vv
If si <> "" Then
si = "(" & tblcol & " IN (" & mid(si, 2) & "))"
End If
InClause = si
End Function
Hope this helps