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

Home Posts Topics Members FAQ

Using a Macro to Add a Date in Access

7 New Member
Hi,
Im wondering if i can use a macro so when a Menu Button is pressed it adds the current date to the currently selected cell?
Ive tried using Now() and assigning it to the Properties of the menu button ive made but it doesnt work.
Any Suggestions?
Thanks in advance,
Sam
Jul 5 '10 #1
3 9300
nico5038
3,080 Recognized Expert Specialist
Hi Sam,

Probably best to use VBA code to do this.
Just place in the OnClick event of the button a Procedure and use the line:
Expand|Select|Wrap|Line Numbers
  1. Me.FormFieldname = Now()
  2. Me.Refresh
  3.  
Best to have a separate button for each date field.

Personally I often use a calendar control, thus making it possible to "click a date" instead of typing...

Nic;o)
Jul 5 '10 #2
FishVal
2,653 Recognized Expert Specialist
@flabbers11
You should use Date() function, which returns current date with zero time, if you want later to search/filter the table with criteria containing only m/d/y portion of date.

Regards,
Fish
Jul 5 '10 #3
NeoPa
32,556 Recognized Expert Moderator MVP
flabbers11: Ive tried using Now() and assigning it to the Properties of the menu button ive made but it doesnt work.
Personally, I'd use Date() rather than Now(), assuming it's the current date you require.

That said, your requirement determines whether it's better simply to set the .Default property of the control, or to update the value on some sort of event. As you haven't shared that information with us we can't lead you further.
Jul 5 '10 #4

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

Similar topics

12
6332
by: Steve Elliott | last post by:
I have a query set up to gather together data between two specified dates. Shown in the query column as: Between #24/09/2004# And #01/10/2004# Is it possible to enter several different date...
6
9823
by: geronimo_me | last post by:
Hi, I am trying to run an Excel macro from an Access module, however when I run the code the macro runs but then I get an error in Access. The error is: Run-time error "440", Automation error. ...
3
7538
by: bwhite | last post by:
I have a temp table with one row of data that I need to export into Excel. I created the export to create the xls file as follows ... Dim FileName FileName = !! DoCmd.SetWarnings False...
6
1646
by: lgn | last post by:
I have test the following program, why the result is not 0 2 4 but 0 2 3? Can someone tell me why the same macro produce different result? Thanks! #include <stdio.h> #define max(a,b) ((a)>(b) ?...
1
2029
by: shinde.shailesh | last post by:
Hi All, I have an xls file which contains data in one column. Also Having .MDB file with Table name "TableTest" and one field "Tabletst". I ahve to extract data from xls to MDB using Macro. ...
0
1225
by: delso_it | last post by:
Hi ...can u help me how to creat a expiretion date access program like demo program...will be expire after 15days or 3days...:)
2
12437
by: musa.biralo | last post by:
Hi, i want to read each row of specific column of musa.dbf using macro (VBA) in excel. my main gole is to copy the data of dbf file to excel file. I am new but want to do something..i tried and...
3
3142
by: Raghavender143 | last post by:
Hello everyone How can i extract all the data from a report to excel worksheet using a macro in access.
0
7044
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
7087
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
6741
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
6944
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...
1
4782
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4483
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
2995
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
563
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
182
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.