I am working on a small access database for inventory, I have created a tbleInventoryTransaction, where user have to select TransactionType, Addition or removal.
Is there any default value formula or other function which will show the quantity value in negative if user select the the TransactionType "removal".
Your textbox for display must be named differently than "Quantity", say, txtQuantity. For this, set its ControlSource to:
=IIf([TransactionType]="Removal",-[Quantity],[Quantity])
Related
I need to run the report, without selecting anything, with parameter field blank, and be able to view all the data.
the problem is that it necessarily asks me to enter a value (all or multi values).
Who can help me?
If you make sure that you do the following...
Set the parameter to "Allow blank value" and/or "Allow null value" depending on what datatype it is.
Set the default value to Blank (="") if applicable
If you have a list of available values set, make sure the default value is included.
The following example uses sample data from sample database and contains just a list of company names and their ID's.
The main dataset query filters the data based on 2 parameters (one is text the other id numeric to show different scenarios)
This is the dataset query
SELECT CustomerID, CompanyName
FROM [AdventureWorksLT2019].[SalesLT].[Customer2]
WHERE CompanyName LIKE '%' + #pSearch + '%'
and CustomerID > ISNULL(#pID, 0)
ORDER by CompanyName
The report design looks like this with 2 parameters defined
The first parameter is text and has "Allow blanks values" checked, the Default value is set to an expression =""
The second parameter is an integer, This time we have set "Allow null value" on but we have not set a default value.
Note: Neither parameter has any available values set...
When the report is run I get the following results without pressing anything.
Only if I manually set any of the parameters do I need to press View Report, but when the report first runs, there is no need to click anything.
If the above does not help, then show how the parameter(s) are setup up, what types they are, what the available values are and what the default values are.
I have a column "Month" in my MS Access 2016 Database Record whose month value say "January" or "February" should be entered using a combo box with the following;
Row Source Type: Value List
Row Source: "January";"February";"March";"April";"May";"June";"July";"August";"September";"October";"November";"December"
Default Value: Month(Date())
However, to simplify work, most months will be entered in the actual current month, this can also be changed using a combo box selection in a case where it is an old entry, the combo box is working just fine, unfortunately, '''Month(Date())''' is not working but only populating the field with the whole string "Month(Date())" as the entry.
What should I put on my Default Value in order for this combo box to automatically return the current month in words, like "January" or "February" .
Use following expression to default value property-
=Format(Date(),"mmmm")
If you want to use an expression in the Default Value property, precede the expression with an equal sign like this:
=Month(Date())
That would give you the month number of the current date. However it sounds like you actually want the month name instead. In that case feed the month number to the MonthName() function:
=MonthName(Month(Date()))
in order to allow a selection of null value in multi value parameter in SSRS project
we can use the query for the data set
Select ID,Value From SpecificTable
Union All
Select NULL,'Other'
in order to let null value returned from parameter when 'other' string is selected from parameter available selections
note:in available values section at parameters properties i have chosen ID Column as Value Field and Value as Label Filed
i have tried the previous query with no be benefit ,the string 'other' doesn't appear as available selection for the parameter when i preview the report
are there any additional configurations that i should apply ?
I don't think you can do it this way... that's why "Allow Nulls" is an option.. what you can do is set the ID value for Other to some obscure value.. like -99.. which the actual ID from the specifiectable can never be.. and modify your stored procedure to say..
where (#id = sometable.someidcolumn or #id = -99)
This should in effect ignore the ID selection! Unless you want it to do something else of course.. then you code accordingly in the where clause.
On my report I have two parameters.
One is for the selection of an order number from a list (dropdown list) and the other is for typing an order number. The idea is to have the end-user either select the order number or type it, not both...
Is there a way I could empty the textbox when a list item was selected and vice versa, i.e. selecting an empty value from the dropdown list once an order number has been typed? I thought about using code but it would be impossible to determine which of the two parameters to use once the "view report" button has been pressed.
Any other approaches to this situation are very welcome.
Thanks in advance for any replies.
Define the parameters
Let's assume the first parameter that allows the user to enter the order number is called typed_value and the second parameter that allows the user to select an item from the list is called list_value.
Prevent list from being used if value is typed in
Add the following to the where clause of the query that populates the list_value
WHERE #typed_value IS NULL
This will prevent any records from being returned when the typed_value is not NULL, blocking the customer from selecting an order from the list if they have already typed in an order.
Update list_value with typed_value
The above code will only remove the list items, but to get the list to populate with the typed value add this union to the query that populates the list_value
UNION SELECT #typed_value WHERE #typed_value IS NOT NULL
If the user leaves the typed_value NULL then they can select any value from the list_value. If the user types in a value, the list will automatically be replaced with their typed_value.
Which value to use?
You can power your report filter off of the list_value and ignore the typed_value because if the user enters any value in typed_value, the list_value will be updated to the typed_value.
Smooth out the UX
Make sure the parameter typed_value allows null value. It may be a good idea to set the default value of typed_value to NULL so that the user can see the list values when the report first loads.
Also setting the default value of the list_value to #typed_value will automatically set the list_value to whatever value a customer types in.
I have a report which returns list of product names and other product specs. This report currently has different search options. My users now also want to be able to search by product number by putting in multiple product numbers.
How can I add a filter by product number which is an optional multi-value textbox?
I have tried to add a multi-value textbox. The report doesn't seem to work when no values are entered. If I put one or more product number in the text box, it seems to work fine. Is there a way I can tell the report doesn't filter on the Null value parameters? Or any other idea to work with optional multi-value parameters?
Here is the setting for my multi-value textbox
Name = ProductNumber
Prompt = Product Number
Data Type = Text
Allow Blank Value (checked)
Allow Null value (not checked)
Allow Multiple Values (checked)
Here is the data set filter
Expression = [ProductNumber]
Operator = In
Value = [#ProductNumber]
Thanks
TL
I think you should trick the dataset filter by:
Expression should check to see if the parameter is blank and if so give expression a 1 else the field.
Value should do the same check and if parameter is blank set value to 1 else set it to the parameter.
But keep your operator.
Alternatively you could do this similarly in the SQL and with more flexibility and performance.
So as you've seen in your own testing, at least one value must be selected with multi-value parameters. You can't set Allow null value to true at design time and if you run a report without selecting any values it will throw an error message.
So you can't really have a report where users can run it with no values selected.
Taking a step back, what you're trying to achieve when ignoring the parameter is to include all Product Numbers by default. So why don't you set the parameter to have a default value of all Product Numbers selected? That way, users can just ignore and leave them all ticked if they don't want to filter by Product Numbers. Seems like a good workaround to me.
To do this, set the default value for the parameter using the same dataset that populates it:
All Product Numbers are now selected and users only need to take action if they want a subset of these returned.