473,473 Members | 1,705 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

command button - save time to record in HTML page

28 New Member
hi,

how do i setup a command button on a page form that when clicked, saves system time in a particular field of a table ?
Aug 21 '08 #1
10 2175
missinglinq
3,532 Recognized Expert Specialist
For just time:
Expand|Select|Wrap|Line Numbers
  1. Private Sub GetTimeButton_Click()
  2.  Me.TimeField = Time
  3. End Sub
For Date and Time:
Expand|Select|Wrap|Line Numbers
  1. Private Sub GetTimeButton_Click()
  2.  Me.TimeField = Now
  3. End Sub
If you're going to be doing any comparing of times or calculating lapsed times, especially if the times may span different days, you should use the Now() function for Date/Time.

Linq ;0)>
Aug 21 '08 #2
orajat
28 New Member
hi Linq,

i no that u are trying to help me..but i'm too new here......i tried usng ur code....but it does not work....req u to please give me the complete code which i could just copy and save in the VB script editor in MS Access

Table name: TimeTracker
page name: TimeTracker
Field name: EndTime
Command Button name: Command0

Take Care.....





For just time:
Expand|Select|Wrap|Line Numbers
  1. Private Sub GetTimeButton_Click()
  2.  Me.TimeField = Time
  3. End Sub
For Date and Time:
Expand|Select|Wrap|Line Numbers
  1. Private Sub GetTimeButton_Click()
  2.  Me.TimeField = Now
  3. End Sub
If you're going to be doing any comparing of times or calculating lapsed times, especially if the times may span different days, you should use the Now() function for Date/Time.

Linq ;0)>
Aug 22 '08 #3
missinglinq
3,532 Recognized Expert Specialist
When people post code, especially when the Original Poster hasn't given the names of his/her controls, they use generic names, and you have to replace these names with the actual names of your controls. So GetTimeButton becomes Command0 and TimeField becomes EndTime.

For just time:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command0_Click()
  2.  Me.EndTime = Time
  3. End Sub
For Date and Time:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command0_Click()
  2.  Me.EndTime = Now
  3. End Sub
Also note, you should never leave a control with the name that Access gives it, like Command0. A month from now this name will mean absolutely nothing to you, or to anyone else who has to work with your code. You need to change it to something meaningful, like GetEndTimeButton.

Also, please note that the use of "texting" abbreviations is not allowed on these forums. Take the time to write complete words and complete sentences.

Linq ;0)>
Aug 22 '08 #4
orajat
28 New Member
i tried using this aswell....but it does not work. Don't know what am i doing.


When people post code, especially when the Original Poster hasn't given the names of his/her controls, they use generic names, and you have to replace these names with the actual names of your controls. So GetTimeButton becomes Command0 and TimeField becomes EndTime.

For just time:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command0_Click()
  2.  Me.EndTime = Time
  3. End Sub
For Date and Time:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command0_Click()
  2.  Me.EndTime = Now
  3. End Sub
Also note, you should never leave a control with the name that Access gives it, like Command0. A month from now this name will mean absolutely nothing to you, or to anyone else who has to work with your code. You need to change it to something meaningful, like GetEndTimeButton.

Also, please note that the use of "texting" abbreviations is not allowed on these forums. Take the time to write complete words and complete sentences.

Linq ;0)>
Aug 23 '08 #5
missinglinq
3,532 Recognized Expert Specialist
What exactly does "does not work" mean? Nothing happens? You get error message? Please copy your exact code, sub header included, and post it here.

I just realized that you haven't said what version of Access you're running. It wouldn't be Access 2007, would it? The reason I ask, is that code does not run in 2007 unless your database resides in a folder that has been declared a “trusted” location.

To trust your folder, click:

Office Button (top left)
Access Options (bottom of dialog)
Trust Center (left)
Trust Center Settings (button)
Trusted Locations (left)
Add new location (button)


Linq ;0)>
Aug 23 '08 #6
orajat
28 New Member
i'm using ms office xp professional....i used your code in the microsoft script editor of the HTML page i made though the ms access page wizard. it does not do anything, ie after keying the values i go to the table to check if the EndTime field has been added, but it's blank and there is no error.....do u feel like pulling your hair... :-)
Aug 24 '08 #7
missinglinq
3,532 Recognized Expert Specialist
i used your code in the microsoft script editor of the HTML page i made though the ms access page wizard.
Sorry, you should have made that fact that you were talking about a web page clear in the beginning. This is really a whole subset of Access and I have absolutely no experience in this area! I'm going to edit your post title to make it clearer and perhaps someone who has experience in this area can help you!

Sorry!

Linq ;0)>
Aug 24 '08 #8
orajat
28 New Member
thanx linq...you've been great help so far... :-)...no need to be sorry

Sorry, you should have made that fact that you were talking about a web page clear in the beginning. This is really a whole subset of Access and I have absolutely no experience in this area! I'm going to edit your post title to make it clearer and perhaps someone who has experience in this area can help you!

Sorry!

Linq ;0)>
Aug 26 '08 #9
PianoMan64
374 Recognized Expert Contributor
is this page an HTML, clasic asp, or aspx page that you're trying to execute this button from?
Aug 26 '08 #10
orajat
28 New Member
i don't kno the difference between them...but....i guess it's html...caus i am using the page wizard of MS access to make this page...and the command button is supposed to be on this page....

is this page an HTML, clasic asp, or aspx page that you're trying to execute this button from?
Aug 26 '08 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: Kevin | last post by:
A couple of easy questions here hopefully. I've been working on two different database projects which make use of multiple forms. 1. Where's the best/recommended placement for command buttons...
3
by: abidh | last post by:
Hi Guys, First of All, Hi to Everybody. This is my first post here and hope to have long time with you guys. SO Coming to the point. I am new in Access and lots of things to cope with. At the...
5
by: dgrabuloff | last post by:
i am inputting records using a form. how do i put a command button on the form that will copy the record i just input----sometimes i have the same record that needs to be put in 3 or 4 times and i...
3
by: Scldb | last post by:
I have a form that is linked up to the tables. I turned off the Navigation buttons. I put in a new command button that when clicked, it opens up a new record. What is the code that is needed for this...
0
by: halex | last post by:
Hello, I need to save to file HTML page from my complex ASPX page (it has MasterPage, MainContainer, UserControls, CSS, JS files...). So, I need to override Render method to to this but I did not...
13
by: Ciara9 | last post by:
I created a command button using the record navigation feature, find record. Does anyone know how to turn off the functionality of the "replace" tab that gives the user the ability to replace the...
9
by: Chuck [Sbc\) | last post by:
I am new to html programming. I have created a web with 17 different pages. On each page is a button menu which allow the user to switch to another page without returning to the home page . The...
8
by: skuer | last post by:
Hey people If I have made a page with login system, are there any possibilities to let a special group of people edit the page or some of the text on the page, just by clicking a edit button on...
1
by: troy_lee | last post by:
I have a continuous form. One of the fields shown is the Primary Key. I want to be able for users to either: Click on the ID number and be taken to that record which is in another database ...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.