I have two parameters: Start Date and End Date, that filter records to include only those in this range.
Issue one: End date cannot be earlier than Start Date - I have a solution currently that just hides the data objects and displays a text box telling the user to re-enter a valid date range. Maybe there's a better solution
(Bigger) Issue two: I need to restrict users selecting Start date to only dates after a certain date eg. 5/25/2013. I tried a function in custom code to check and change, but unfortunately Parameters in custom code are read-only. I thought of a check in custom code and refreshing the parameter to default (an appropriate value eg. 5/25/2013) but I haven't been able to do that.
Something like this would be ideal:
Public Function DateCheck()
If (Report.Parameters!Open.Value < DateValue("5/25/2013"))
Report.Parameters!Open.Value = DateValue("5/25/2013") 'or refresh to default value
End If
End Function
Also, where do I put the Code.DateCheck() call if it works?
Looking forward to positive responses
I create a second but hidden parameter tor both that will modify them as required e.g. a second open called open_mod that is automatically set by a dummy sql like (example is in Oracle):
Select greatest(#open, '25/MAY/2013') from dual
Related
There is probably a simple solution to this, but it is eluding me.
I have a textbox (name = CFMon), that references a month textbox. The user will submit values for all months, but they select a key month that is used for a calculation. I need to use their selected key month to get the value from the appropriate month textbox (each month is named mon1, mon2, etc)
When not using VBA, I would simply use the indirect function to evaluate all of the string.
test = Forms![Form]![CFMon] & ".value"
this does exactly what it is supposed to do and just regurgitate the text string
I am hoping the evaluate the reference and return the appropriate month value. For Example. The user selects CFMon = Mon3, the value will return the value the user inputs in the Mon3 (March) textbox
You could obtain the control from the Controls collection, e.g.:
test = Forms("Your Form Name").Controls(Forms![Form]![CFMon]).Value
Alternatively, you could use the eval function, but I would advise against this:
test = eval("Forms![Your Form Name]![" & Forms![Form]![CFMon] & "].Value")
I have been trying to figure out how to appropriately define a date within a newly created custom field that references the current transaction date and 'adds' an integer value from an existing custom field in NetSuite that's located on the same form (a PO). Each time I submit, I get an error for an invalid expression or the value is simple null.
Here's my code:
CASE WHEN {entity} = 'Test Vendor' THEN
{trandate} + {custbody01}
ELSE 56
END
"custbody01" represents an existing value that has been calculated within a custom field (integer). The idea is for a pre-calculated value (integer) to be added to the current transaction date to calculate a future date in the custom field. I am very new to NetSuite and could really use any help provided.
Thank You
I've had a similar requirement. I've needed to add an int to a date. I believe you just need to use the TO_DATE() function.
Here's the code I specifically used as a workflow condition, but I believe it would be transferable, so long as custbody01 is indeed an int value. (custbody456 is a custom date field, adding an integer value, to calculate another date field)
Estimated Ship Date=to_date({custbody456}) + 17
So I think for you, you may want to try:
TO_DATE({trandate}) + {custbody01})
When executing, this code will reference the existing custom field and add that value to the current transaction date.
I'm using command buttons to import excel files into various tables, and I want to track the last time each table was updated (i.e. the last time the command button was clicked and ran successfully).
I've tried doing this by adding a text field next to each command button, and then adding Me.TextField1.Value = Date to the _Click subroutine for each button. This fills in the date correctly, but it doesn't save the value when I close the data base.
How do I keep the date value from resetting every time I reopen the database?
The way I would probably approach this is to add a table to your database that contains a list of all the Excel files you import on a routine basis. You would store the filename of the Excel file in one column, and the updated date in another column.
Then you can use the DLookup() function to pull the updated date into your text box by your command button.
Of course there are many approaches you could take here, but which one is best depends on your specific needs. If it is just you running this application on a single computer, you might find it easier to use the SaveSetting/GetSetting functions to save simple values to the registry.
SaveSetting "ExcelImporter", "sheet2.xlsx", "Updated", Now()
TextField1 = GetSetting("ExcelImporter", "sheet2.xlsx", "Updated")
If you have a lot of spreadsheets, you might consider a list box with two columns, one with the name of the file, and the other with the date it was last updated. Then you could use a single button to run the update, based on the selected file. Lots of options... :-)
Add a Date/Time field to the table you are updating and set the Default Value property of the field to Now(). When new records are inserted, they will automatically have their insert date and time set.
If you are updating existing records, then update this field to Now explicitly.
You can query this date with
Dim lastUpdate As Variant
lastUpdate = DMax("DateFieldName", "TableName")
In addition, you see when each record has been inserted or updated.
TextBox values are not saved permanently, unless the RecordSource of the form has been set to a table or query and ControlSource of the TextBox has been set to a column of the table or query.
You could create a Custom Database Property to hold the last time the button was clicked.
Function getLastTimeClick() As Date
Const PropertyName As String = "LastTimeClicked"
On Error Resume Next
getLastTimeClick = CurrentDb.Properties(PropertyName).Value
If Err.Number = 3270 Then
CurrentDb.Properties.Append CurrentDb.CreateProperty(PropertyName, dbDate, Now)
End If
CurrentDb.Properties(PropertyName).Value = Now
On Error GoTo 0
End Function
in my Access application I have a form and a report. In the form I have my textBoxForm, in the report I have my textBoxReport. Normally, in the textBoxReport I see the textBoxForm value. How can I set dynamically from the report VBA-code the value of the textReport? For example, I want that, if the value in the textForm is 1, the value in the textReport is "ok".
I have already searched a solution in internet, but in all cases I see always an error similar to 'impossible set this value for this element'.
Thank you!
Does your report use a query? If so, you would just place an 'IIF' in the query that tests for the value you want to change, then either changes it to something else, or retains the original value. The below will test field 'Nbr1' for the presence of a 1, and if found, change it to 'OK', otherwise it stays the same.
Note! You will need to change the control source in the report to reflect the name you provide (i.e. 'MyChange') because you can't keep the original name.
SELECT Table1.ID, Table1.EMPID, Table1.TestResult,
IIf([Nbr1]=1,"OK",[Nbr1]) AS MyChange, Table1.Nbr2
FROM Table1;
I have a datepicker in a vb.net clickonce application. I need to make sure that in order to use the application that selecting a valid date is required. Ideally, I would be able to set the value of the datepicker to null and then programatically create Try Catch logic based on datepicker1.value still being null. Unfortunately, it will not allow me to assign a null or blank value to the datepicker. I cannot create my logic based on any real values of the datepicker because who's to say the value picked is not valid. I've tried setting the value to some outrageous date that no one would pick for the application like 1/1/1970, but then the datepicker opens up at 1/1/1970 and drops that date in as soon as it gains focus. I need a way to validate whether or not someone has selected a date, but am stuck and can't find any real help online. I am not looking to set the customformat = "", so please do not respond with that solution. I need the actual value to be blank or something I can run validation against to know that the user has in fact selected a date.
Set the ShowCheckBox property to true. That will make the control look like this...
When the user selects a date, it will check the checkbox. Then when you need the value...
If datePicker.Checked Then
'user has selected a value
Else
'user has NOT selected a value
End If
Can you use the ValueChanged event to set a flag to tell you they've clicked on a date?
UPDATE
You could also use the OnClick method to set a flag to verify the user actually clicked on the DateTimePicker.