Adding system time at request

Doug123

Board Regular
Joined
Aug 13, 2005
Messages
110
I am new to Access. I have created a table called "Bollards". I want the field to fill with the system time when requested by an operator similar to a drop dow box in Excel.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Hi
I'm not sure about the Excel drop down box part but in your table design, provided your field is of the type 'date/time', then set the default value to Now() and set the format to 'Short Time' (or something similar to suit your needs).
HTH, Andrew :)
 
Upvote 0
Thanks for that. However, in Excel the system clock time inserted into a cell when I clicked tab or return on the cell. In Access I would like to tab to a time field and insert the system time. Any further ideas????
 
Upvote 0
Doug

Are you working with Excel or Access?
 
Upvote 0
I have this Excel macro to insert time on request. How can it be adapted to Access.

Private Sub Pass_Number_BeforeUpdate(Cancel As Integer)
Sub CellDate()
Dim MyTime
MyTime = Time
Value = MyTime
End Sub
 
Upvote 0
Ok,

Now, if you don't have a time field set up in Access, manually enter one into the table. Make sure the Time field is date and time and you have the proper format setup, i.e., medium time, etc.

Now, go into your form and select the Field List icon from the menu bar. Now you will see a small window appear. Select the Time field and drag it into your form. Once placed, right click on the Time field text box(what you just dragged over). Once you right click to view the properties, make sure you have selected the ALL tab from the right-click popup menu. Go to the Control Source property on the ALL tab and delete the Time name from the field and enter the following:

=Time()

Now goto the format tab and make sure the time field setting is the same as the one in your table, i.e., medium time. Now, for every record that is entered into your table, the current system time will also be entered.

Please respond to this post to let me know you are actually using this advice...I would hate to be wasting my time...

Hope this helps...
 
Upvote 0
I think I made a mistake advising re: the text box, which was the other post.

Try the following for the time.
Go into Form design mode for the form in question, select the Time Field text box...not the actual label that accompanies the text box, the box where you will actually enter the data. RightClick and choose properties. On the ALL tab of the righclicked dialogue box, you should see control source. Make sure that reads the field that is time, so if you named the field in your table TIME, just leave it.

Goto the Default Value property (line that is 3 or 4 lines down, something like that) and type =time().

Now, you have to make sure you have an add record button on your form so the records are added to your new table. Goto the toolbox toolbar and select the button object. Draw one on your form and play with the wizard.

Now, if you have your combo box with the 4 default values and your time field as I told you to set it up and the add record button, and they are set up correctly, run the form and select one of the 4 options in the combo box (gate field, or whatever you named it) and press the add record button. now go back to your table and you should see the record in your table with the current system time stamp. Try that...

Let me know if the combo box worked...
 
Upvote 0
I can see now, how to insert an operator button in a form field. I want the time to appear in the form field when the button is pressed. I will explain further:-
Each field will be triggered by an operator when an event occurs. For instance, when I get a request to open a certain gate eg NE H-Field, the operator clicks on that field (in the form), clicks on the down arrow to reveal all the gate names. He then selects the appropriate gate and tabs to the next field, say "Bollards". This event will occur when electronic bollards are lowered. When this happens, the operator clicks the "Time" button which then inserts the system time into that field, for that record and so on for each of the other form fields.

The form fields I have in a table. How do I link each form field with the corresponding field in the table???
 
Upvote 0

Forum statistics

Threads
1,215,047
Messages
6,122,858
Members
449,096
Latest member
Erald

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top