I have a table including start time & end time fields. I want to insert the start time, that should be automatically appears when I type something in a row. And I want to insert end time, that also should be automatically appears when i go to the next row.
I have entered as time() in default value from the design view. But I get start time & end time as same. That is not right. What is the correct method to fix this.
Can any one help to me?
Wayne is right as long as you are entering information directly into the table, I do not believe there is anything you can do to record the end time. If you want to use a form this would be possible. Forms are generally better for data entry anyway.
The event you would probably want to use would be "After Update" (ie. After one of the fields change) you could either use the code after the last field (ie. only show end time when the last field is entered or changed) or for every field (this will give the last time any field was updated regardless of order)
The code would look like this (with your actual fields):
Private Sub Field_Name_AfterUpdate()
Me![end time] = Now()
End Sub
You can find the events from the design view click on the field and open the property sheet then go to the event tab and click on the "..." the go to code builder and you would just add the line of code in the middle (make sure the field name matches exactly) (it will automatically add the first and last line)
===========================================
Edit:
Ok so three main things are stopping you right now. I know this can be really difficult when you start, but as soon as you get it to work it will feel amazing.
First - you do NOT want to place the code under starttijd because that field just starts with the default value and never changes. Thus putting code on the Before update or After update will not run. You need to place this in the fields that are updated (ie the fields people fill out with the form) So if they fill out a name for example then you would place the code there
Second - The code is meant to update the END time not the start time ie Me![END]=Now() not Me![starttijd]=Now()
Third - The code you will want to run on After update not before update. Though this is not as important as the above two
Related
I want to find out 'last changed on/by' for a large number of elements going in 'se11' and checking it's attribute value .
So instead of copying each elements name and checking it's attribute for the same value, is there any table or database in which i can get the values for multiple entries at once?
Picture is attached in the question for the reference.
With the cursor placed in the field you're interested in, press F1, then select the technical info. This will show you the table name or - as in this case - a structure named RSDXX, which is not what you're looking for - but it is the fastest way in some cases.
Alternatively, start transaction ST05, enable the SQL trace and navigate to the display in a separate window. Then stop the trace and examine it - you will find a list of all tables accessed for the process. Very near the top of the trace list, you will find a table named DD02L which is the one you're looking for in this case.
I have some data that I want to be displayed the following way and I cannot find how to do it:
For example this would be the keep together case:
But I don't like that I have a lot of blank spaces when data is too much, so I would like the following to happen if possible.
When the colNames and the first row can fit in the remaining space put them there.
Or if more can fit after the first row, put all of them there and split where it is possible if necessary.
Basically I want a 'Keep together' option for the columns and first row, and everything else can be splitted at any point.
If anyone wants to achieve the same functionality do the following:
Put the table column names inside a GroupHeader and set its GroupUnion property to WithFirstDetail.
Put the table rows in the Detail next to the GroupHeader.
By doing this the WithFirstDetail property, as the name suggests, will try to keep the header with the first record, or move to the next page. Therefore achieving the behavior described above.
I am using stored procedure in mssql as backend, vb.net as frontend (just info).
There are a lot of records in the database and I am printing in crystal reports.
Now I want to filter the records from crystal report and not by adding a new parameter to procedure or changing database structure or else.
For now,Say there are columns : Name , Amount.
I want to put filter in amount like only display records whose amount above 100 or something. So other records with less than 100 should not be displayed.
This filter will be passed by the user so it'll be random.
I can't find a proper answer on internet. Might be a duplicate question, if so please post the link of the question if it is duplicated.!
Thanx anyways...!
In general the idea is to:
Create the parameter (user choose what will be the input/value) - link
Set filters, what values should be displayed in regards to parameter - link
On right side there is a DataExplorer window, where You need to add a Parameter (define his name, what question will be shown to user and what type the param will be / what values can be set inside).
Once done, You can jump to Data tab of a report, click Interactive Filter and specify which column must fit what condition with what value = Parameter (that one user will enter in Report).
Example: I will create AmountParam, with message "What should be the minimum amount?". Type will be set to Integer. Going to Report->Data->Interactive Filter, choose Amount as a Column, AmountParam as a Parameter and set condition Greater then (>).
Currently I'm attempting to determine how to easily be able to enter data either in Excel or Access. I'd use the Data form tool in excel however I'm using a scanner that's configured to send an enter command after a successful scan so it would move to the next cell.
Serial Number Employee Time
123 Brian 8/20/13 8:49:21 PM
213 Brian 8/20/13 8:49:21 PM
334 Nick 8/20/13 8:49:21 PM
I'd like to be able to have an accurate time that the serial number was scanned. As it is right now every time a change was made on the sheet the time updates which really defeats the purpose. I'm currently using this formula:
=IF(A2<>"",NOW(),"")
I'd also like to be able to make the employee name able to be changed but also stay the same during the time when that person is scanning the items. I tried just referencing a dropdown list but, when that field changes so does the rest of the employee field.
I'm guessing that this would be best suited for Access because eventually this will be located in different locations and I'd need to be able to correlate the data.Honestly, I'm just too unfamiliar with it to be able to really create something amazing and have it work.
Any help would be GREATLY appreciated.
Because your serial numbers most likely correlate to some articles and you already think of multiple locations and users, I would suggest using Access.
All this leans more to a datebase, which might not be that intuitive to set up for you as excel would be, but in the end it is way more solid and easier to handle, when it comes to catching dublicates, and making queries.
However, it can be done both ways. But not using now() - because this function would update your time, whenever recalculated. That is why you get the same time over and over.
You would have to create and call a function, which inserts the time as fixed text, not as dynamic content.
On Access however, using a now-function as the default value for a field would work, as the database-entry would be the value not the function.
For Excel you would have to ramp up this function and could create/activate a keylistener, when activating a new Worker:
'This code goes into a VBA-Module
'and can be access on a Worksheet calling =myScan("test")
Public Function myScan(strWorker As String)
Table1.Cells(2, 1) = "1"
Table1.Cells(2, 2) = strWorker
Table1.Cells(2, 3) = Now()
End Function
The Serial-Number can be derived from the row. The main Problem would be to stay on the current/next row to paste the data in.
But you could - just for instance - create an Excel Dialog to select a Worker, then activate a Scan mode and scan ... you could even connect to a Web or Access database, not storing the data in excel, which I would highly recommend ;)
Edit
'This code works, when you place it as the VBA-Code of your worksheet
Private Sub Worksheet_Change(ByVal Target As Range)
'react only on changes on column A
If (Target.Column = 1) Then
'react only on changes on column A when the row is greater than 5
If (Target.Row > 5) Then
'use the current time for Bx
Me.Cells(Target.Row, 2) = Now()
'use the user-name from C2 in Cx
Me.Cells(Target.Row, 3) = Me.Cells(2, 3)
End If
End If
End Sub
Use ALT+F11 open the VBA-Editor and choose the table-object you want to use and place the code above into it, than save as a Macro-Excel-Dokument.
Your worksheet should look like this:
It will automatically update, whenever you change something from A6-Ax.
The short answer is; Excel is NOT a database. If you're going to be reporting on data, and it's going to contain a LOT of data, don't even consider Excel. It's a SPREADSHEET, not a DATABASE.
I'm working on a report in Reporting Services and I can't figure out why I'm having trouble with Non-queried report parameters.
I'm trying to get the current year and have tried:
=YEAR(TODAY())
=DATEPART("yyyy",TODAY())
I have also tried TODAY instead of TODAY()
All of these seem to break the Year dropdown on my report. I thought if something was wrong it would just not get the correct default... but nope, it breaks the whole field.
Any thoughts? articles?
UPDATE:
Wait, wait, wait... the weirdest thing. The Year parameter is the second parameter of this report. And its grayed out (with no value) UNTIL I select the first parameter (im my case "category"). Am I somehow telling the Year param to do this? or does SSRS 2005 process the params in order? I don't think I ever noticed this before.
UPDATE 2:
Please see all comments
=DateTime.Today.Year
should work as well.
Edit: Bruno - i have the same behavior as you are seeing. I created a sample report with a string first parameter with no default value, and a string 2nd parameter with a default of =DateTime.Today.Year. When I have the one with the default as the 2nd parameter in the order, it shows up empty and disabled.
I was able to fix this problem 2 ways: first by adding a default of =String.Empty to my first parameter, and the second way was to just change the order of the parameters.
Not sure if this behavior is by design or a bug - but like you said, I hadn't noticed it either until today when you pointed it out in your question.
Try:
=Year(Now)
I'm not sure if this is what you need, but it worked for me. I used it to form a date string so I used =Year(Now).ToString().
SSRS does process the report parameters in order - order can be important if you have dependencies between your parameters.
From MSDN: "Parameter order is
important when you have cascading
parameters, or when you want to show
users the default value for one
parameter before they choose values
for other parameters."
So, it will always wait until you have a default value for your first parameter or you enter the first parameter's value, before it processes the next one, and so on.
http://msdn.microsoft.com/en-us/library/cc281392.aspx
I found the by making sure that ALL of my parameters had at least some default value, then you will not experience they greyed out datetime picker. So, every parameter before your datetime paremeter in order needs to have a (default) value or it will not work.
Def due to order of evaluation of parameters.
Simple workaround ; in the parameters tab you can change the order of the parameters - this will move the date pickers to the top of the list and are then enabled straight away, on my server at least.
Someone raised the issue of basing a date filter on a queried default value - if you do this, you will notice a very annoying knock-on effect of getting screen refresh any time the dates get changed, before you have a chance to requery the reports.