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()))
Related
I am attempting to create a parameter which looks at the values of a field in the report which is calculated based on the entry of another parameter.
Specifically, the first parameter is a number option (30,60 or 90) and the field expression is a DATEADD that adds the parameter value to the value of a date field.
The next parameter I need is to pick dates in the "expression field" that fall into a certain range. i.e. user chooses 30 so the report generates and populates the "Hire Date" + 30.
I want to then only select the records where that new date falls into a specified range i.e. Effective Date 2/1/2020-2/29/2020. I have been looking everywhere, but cannot find an answer and I don't know if it is possible.
Results example
[EffDate Field[\]\[1\]][1]
I think this was what SuperSimmer 44 was referring to that I couldn't understand before.
I added the following parameters:
Wait - which is an integer & has set available values of 30, 60 & 90
From - Date
To - Date
I kept the field "Effective Date" in my report which was the expression =DateAdd("d",Parameters!wait.Value,Fields!HireDate.Value)
I then added a filter to the Dataset that said if the value of the expression =DateAdd("d",Parameters!wait.Value,Fields!HireDate.Value) was between #from & #to then they should include the record in the results. It worked perfectly.
Report Sample
Insert 2 parameters, one called qty to hold available values from a list 30/60/90 or 120 etc
the other called date to hold your from effective date.
Set up a calculated field in your dataset called effectivedate that utilised DateAdd, for example ie: =DateAdd("d",Parameters!qty.Value,Parameters!effectivedate.Value)
Then set a filter on your dataset that utilizes this calculated field.
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])
I need to make the default value for a certain field in Access be a certain letter representing the current month. For example, the month of January displays "A" the month of February displays "B" etc.
What I have now is:
=(Month(Now()),"A","B","C","D","E","F","G","H","I","J","K","L")
Try opening the table in Design View and setting the Default Value property of the field in question to
=Chr(Asc("A")+Month(Date())-1)
I am looking into a query from one of our users regarding the behaviour of date pickers on their report.
They have asked that when they enter a date in Date Paramater A that this is then duplicated in Date Parameter B.
I can achieve this when the report is first run by given Date Parameter A no default value (so it has to be chosen by the user) and seet Date Parameter B's default value via an expression to "=Parameters!StartDate.Value".
The question though is wether or not I can recreate this when Parameter A is updated. Therefore if they run the report once and then decide they need to choose another date. Can I set Date Parameter B to refresh each time Date Parameter A is changed?
E.G
Report is opened
Date Parameter A is set to 02/12/2013.
Date Parameter B now defaults to 02/12/2013.
Search is performed
A second search is required so, without closing the report the user changes the date in Date Parameter A
Date Parameter A is now set to 05/12/2013
Date Paramater B still says 02/12/2013 - can I somehow make this auto refresh to match Date Parameter A if Date Parameter A changes?
EDIT: Thanks to Kalim for pointing this out but it must also be noted that although I would like Date Parameter B to default to the new value selected by Date Parameter A, dates greater than that selected for Date Parameter A must also be available in case they wish to widen the range of dates.
Hopefully that is clear, but if any further information is required then please let me know.
Thanks in advance for your time and help.
You should be able to set the "Available Values" to the value of the first date parameter.
Select "Available Values" then select the "Specify values" option. Add a value and edit the expression of the value. Set this to the same expression you used in your default value expression.
Hope that makes sense!
Screenshot:
I have a report with three parameters: A country combo box, a start date and end date (of the fiscal year). I want the start date and end date to be updated depending of the country combo box selection.
I made a dataset that receives the country code as a parameter and returns the start date and end date for the selected country. Then I linked the default value of the dates to the dataset.
This works perfectly the first time a country is selected but not for the subsequent country selections. If I change the type of the dates parameters to combo boxes it works every time but I don't want to lose the flexibility of "fine tuning" the dates after the country is selected.
am I asking the impossible?
Microsoft regard this behaviour as being by design - see this Microsoft Connect issue.
There is a workaround in general - the dependent parameter gets refreshed when its values are invalidated by the selection in the first parameter.
However, since you want the users to be able to override the start and end dates, you can't specify that the default values for the country are to be the only values available.
What you could do would be to add a second country parameter after the first, whose default and only available values are the value of the first country parameter, and to set the default values of the start and end parameters based on the value of the second country parameter.
Unfortunately, if you set the second country parameter to be hidden, its default value does not get populated - so the second country parameter would have to remain visible, for this to work.
You could make use of this - for example, by displaying the default date range for the country as the label for the parameter; this would enable the user to see where the default date range has been overridden.