Crystal Reports - Prompt for Total Page Count - sql

I have a report that I'm using to create individual shipping labels for product delivery. Company Name, Address, additional fields are all straight forward and drag and drop into report, requiring little manipulation.
My issue comes about in trying to determine how I can prompt the user for the quantity of labels needed for print. This will change from shipment to shipment based on how many boxes are required to fulfill the order. Each box requires its own shipping label. I would simply have the user specify quantity at the "copies" section of the print screen but I also need a field on the label stating n of m so the customer knows total boxes shipped and has an identifier for each individual box. For this reason, I'm curious if and how I can prompt the user before print to provide "total page count", where I can then create the number of needed documents and increment per label using the "page number" field, creating a prompted n of m function.
"Total page count" and "page number" are special fields that I seem to have little access in manipulating so if you know how I can prompt a user for necessary label quantity "total page count" then increment per label with "page number",(to achieve an incrementing N of M function where M is defined by the user) in this manner or another let me know.
Thanks,
Travis

Related

How do I validate a Form input field with a Table row value in microsoft access?

I am having issues with setting a Validation rule in Access.
I have a database with the tables Clients, TypeClient, Sales, SalesList, Items.
I have a form for Sales, with a sub-form SalesList inside which has a relationship with Items in order for me to put several stock items in Sales instead of only one item.
Inside Sales table is ID, Date Sold, ID Client.
Inside SalesList is ID_List(referenced to ID in Sales), ID_Item(referenced to ID in Items), Quantity.
Inside Items is ID, Name, Stock(how much we have in stock), Price
The issue is that I am trying to validate the data I enter in the sub-form Quantity field to be higher than 0, but no higher than the available stock.
The issue is that I have tried using the expression builder to get the value from a calculated query that has 2 fields - the ID and the value for that id, with criteria that is for the ID to get it from the main form, the sub-form, the combo box input and the query works.
But when trying to get it like this:
It shows an error "The expression [Query bla] you entered in the form control's ValidationRule property contains the error The object doesn't contain the Automation object 'Query bla'".
I tried using directly the table Value(but it won't work anyway as it doesn't know for which field to get the stock value from), still the same error. I guess it can't reference to anything else? Normal validation rules work, but I want to validate it not to exceed the value of the available stock for the item I am selling now.
Nowhere on the internet there is a tutorial how to do it with expression builder. How do people validate their fields then?
It doesn't stop me in this case to sell 200 items when I currently have stock of only 2 of them, for example.
Note: I have tried DlookUp in expression builder, straight up tells me No.
Sample wrong validation rule expression builder code:
<=[Query bla]![Stock]
<=[Items]![Stock]
I am currently using VBA and fetch the record I need(the current stock) with one of the following and my unbound text is changing on every subform to the same, it shouldn't happen like that. What can I use to populate a field for each record uniquely:
Private Sub ID_Product_IZBOR_Click()
'Me.Stock_ValueField = DLookup("[Nalichnost]", "Stoka", "[ID]=" & Me.ID_Product_IZBOR)
Me.Stock_ValueField = Me.ID_Product_IZBOR.Column(2)
End Sub
Partial solution: I created a new Dim as Integer and fetched the records based on the ID provided by the field in the form and used BeforeUpdate to validate the current stock. Unfortunately the only way to see the current stock level is to click on the combo box where you choose your product and check the column for that one, it doesn't show anywhere else :(
Don't use the expression builder (I NEVER do) - just type the needed expression in property.
>0 AND <=DLookup("Stock", "Items", "ID=" & [ID_Item])
Another approach is to return Stock in textbox ControlSource then ValidationRule references that textbox. Also, user can then see the quantity limit. Methods of pulling the Stock value from Items table:
include Stock field in Items combobox RowSource - textbox then references column by its index (index begins with 0): =[cbxItems].Column(2); VBA may be needed to Requery combobox after record entry/edit is committed to table.
include Items table in form RecordSource - bind textbox to Stock field (Locked yes and TabStop no)
DLookup() expression in textbox ControlSource
Use ValidationText property to give users a custom message.
However, ValidationRule will not prevent user not entering any value if they skip the control. If you want to make sure a value is entered, either set field as required in table or use form BeforeUpdate event to validate record data.

(Access) search text field for strings matching those in another table's field and display these matching records in a subform

Here's my situation,
tbl_products / frm_products
ID__products
products__name (short text)
products__description (short text)
tbl_articles / frm_articles
ID__articles
articles__name (short text)
articles__body (long text)
I have a form bound to tbl_articles containing a subform bound to tbl_products.
What I would like to happen is,
once a user enters text into the articles__body field, (using the After Update module)
it searches this long text field for any words which match a product name
and then (in the subform) displays the matching products.
For example if the articles__body record that the user is currently viewing contains 'product 1', it will display product 1's record in the subform.
Perhaps After Update is not appropriate as it needs to appear to remember these matches. For example, if tbl_articles' record 1 matches/displays product 1 on the subform whereas record 2 matches/displays products 2,3 and 4; I need the user to be able to revisit record 1 and see the product 1 match without having to edit the text (and trigger the After Update).
I have no idea where to start with this. It's not a simple if string contains, Originally I entertained the idea of something like - Like '* [in tbl_products, record 1's products__name] *' repeated for each record (obviously not the correct syntax but simply identifying the process to myself), however this is impractical because the number of strings to match against will grow over time as more products are added.
Any help would be great,
Kind regards
Set Filter and FilterOn properties. Suggest naming subform container control different from the form it holds, like ctrProducts.
Me.ctrProducts.Form.Filter = "InStr('" & Me.articles_body & "', [products_name])>0"
Me.ctrProducts.Form.FilterOn = True

Filter a Report based on user input

I created a report template which I want to open a single page report based on a specific IDENT NO. All of the fields in the report are then generated from the associated IDENT NO.
Currently, when I open the report, it will create a single page report for each ID number in the Report Data table when opened.
Instead, when the user is attempting to open the report, I want to prompt the user to enter the identification number of the specific report they are looking for so that it only opens that single individual 1 page report associated with the entered IDENT NO.
How could I achieve this filtering?
An alternative to using InputBox is to use a "parameter query" (documentation here)
Anywhere in a query criteria or report design view you may enter [IdentNoVariable] and a dialog box will appear (when the report or query is run) asking you to "Enter Parameter Value" for IdentNoVariable.
For example, if you wanted to restrict an ID # during a query (say the query that your report calls):
The dialog box seen appeared upon running the query and has the text of the variable seen in the query criteria. This same thing can be done in a report by entering [IdentNoVariable] into the part of the report where the entered value is desired.
You can display an InputBox for the user to insert the ID and then open and filter the report.
Dim id As String
id = InputBox("Enter the identification number:", "YourInputBoxTitle")
'if a value was entered, open and filter report
If Len(Trim(id)) > 0 Then
DoCmd.OpenReport "ReportName", acViewPreview, , "[IDENT NO] = " & id, acWindowNormal
End If

How can i sort checked checkbox items and send them to labels in vb

i want to write a mechanical eng. software to calculate kitchen hood exhaust flow rate and make a report.
firstly, user will check the calculate button, secondly user will check gas or electric and then user will enter the area.
for example, user select two random types(there are 40 types of kitchen hoods) and selects gas and enters areas. i will make calculation from these selections but my problem is: i can't write them to second form with sorting the selected ones.
you can see label 1, label2 etc. i can send the selected box text to labels with if statement:
If CheckBox1.Checked Then
Form2.Label1.Text = Label5.Text
End If
but i don't know which one will selected and i will have 40 types but in report part (form2) i will have maximum 10 types(because of the general layout of kitchen designs). so i want to sort selected ones and add report form without any blank rows.
i'm really sorry for my poor English.

Displaying pagination

I have a report for sales in iReports 3.7.6
For the properties of the sold items I have "stretch relative to tallest object" and it repeats depending on the number of items sold.
The thing is, whether the number of items sold, or if the description of a single item is long enough that the report breaks into two pages, the field for "page X of Y" will not display on the first page, only on the last page, this happens regardless of "page x of y" being set on the Page Footer band or Last Page Footer band.
Shouldn´t the report save some space for the footer regardless of the Detail 1 band stretching into a second page? Or is there any way to order reports to do so?