Macro to put today's date in a field

Hi all,

I'm new to access and was designing a nice form. Then I wanted to do something easy, that what I was thinking. What I need is a button that when pushed it will insert today's date in a field (the field is called Start Date).

I must be missing something as this I can't make it work. It must be so easy as it is in excel, but here in access I'm lost.

Can some one help with how the code should be.

Thanks in advance.

Post your answer or comment

comments powered by Disqus
First off, Im using Access 2000, and created a new module.

Ok, Here is the info:

-A table called Indexing contains a field Index9
-Index9 needs to be updated to the current date, in a particular format.
-the format is as follows: YYYY-MM-DD

I would Like to create a module to do this, but im not sure how i would make this run or work, meaning do i make a function? how do i get it to run? using a macro? etc etc...

But first off, how do i update Index9 with the date in the particular format?

Here is the code i could come up with:

Sub Format()

Dim strSQL As String

Dim currentdate As Date
Date = Now 'Format(Now, "yyyy-mm-dd") how do i format this?

strSQL = "UPDATE Indexing, SET [Index9] = Date, WHERE [Index9] Is Null;"

DoCmd.RunSQL strSQL

End Sub

-Your Time and efforts are much appreciated

my query is:
i have a form with fields on, and when i click next button to display a new form, would it be possible to enter todays date in a field. so when entering a new record i would press next and it would have todays date in one of the fields and the rest blank.

would this be macro code or what ?

thanks in advance.

ps - yeah i know ctrl + ; enters todays date for u but i want to do it automatically


I have 1 field column that I want to put all records in a single form label.

How do I do this?


Hey all,

I was wondering if it was possible to put an expression in the field box of a query?

Here is what im trying to do. I have a report that is based off six columns of a query. The first five columns are basic information like product name, part number, department, manufacturer, and region. I would like give the user the ability to change the variable that the 6th column contains. The query is based off a table with around 200 different fields. I would like the user to be able to define which of these 200 variables fits in the last spot on the report.

I'm not sure if this is possible so i figured this would be a good place to look for tips.

Right now here is what I have.

Query: Main Query (Based off the table Basic Program Info)
Table: Basic Program Info
ComboBox: The rowsource of this combo box is Basic Program Info, and the row source type is Field List.

The query has 6 columns. The first five are Product, Part Number, Department, Manufacturer, and Region.

For the 6th column, I am trying to write and expression as the Field. Right now I have Form![Product Search].ComboBox, but that doesn't seem to work.

Does anybody know how I could make this work or are there any other ideas I could try?


I need to konw how to Count different dates in a subform query?

I am trying to find all IDs in a field that startss with *. I have tryed various forms of using LLeft but it says that the function is undefined. I have names like *CO5468 and I need to find them. I tryed things like Left(tblTemp_Import_File.Accpac__c],1)'*') and Like [*%], but nothing works.
Any ideas would be really appreciate it.
Thank you

I need a macro that can Replace information in a field on a table. basicly i have a "Receiving" form with 10 spots for S/N's when the user "Saves" the infomation i want the "Location" to change to "SAI, Shelton" on my "Main Inventory" Form. or maybe there is VB code that can do this.


I am trying to create a form for official receipts. However, in the process of creating one, i realise its field is linked to a new table, so i need to put down the field name in the table before creating a form.

But when i put the word "date" in a field. A warning message stated that it is a reserved word.

I need the word "date" shown in official template receipts. How can i go about it?

Thanks in advance


I need a field in a query to show todays date and a date 10 days from now in ISO8601 format like this:


It should only display when another field is "true". Here's what I have so far and it's incomplete:

sale price effective date: IIf([inventory]![SaleOn]=Yes,Date())Format [sale price effective date], "yyyy-mm-dd"))

Can anyone help me put the finishing touches on this or tell me if I'm barking up the wrong tree with this approach?


Hi, How can I determine, through a query, the latest date in a date field for a table.

The table has two fields. The first is Ref_No, the second is Rec_Date.

Ref_No Rec_Date
abc-1234 01/01/04
abc-1234 01/08/04
abc-1234 01/05/04
bcd-2345 02/17/04
bcd-2345 02/07/07
bcd-2345 02/21/04

I need the query to come back with only the latest date for each Ref_No:

abc-1234 01/08/04
bcd-2345 02/21/04

Thanks for any help

I have a query which counts the number of records between certain dates in a table, and of course use 'Count' for that. Now how do I count the records which have a 'Yes/No' field set to 'Yes'? I have several of these fields so I don't want to limit the query to return only 'Yes' fields, I want to count all of them.


how do you create a query that will select a certain field and all its records and put those values in another field in the same query. THEN (and this might be another query) i want to put todays date in the date field of every record in this query.

Hi there,

In a certain field in a table, we put certain codes to detail what has to be done for that job.

On our summary form, we have a section detailing the job after we print it out we handwrite an 'X' in the box to mark it.

For example on the summary form we have:
[ ] quote
[ ] emergency
[ ] agreed rates

... etc, where [ ] is the box.

What expression can I build for the little text box to put an X in the box for the code that matches that row? Note that sometimes we have multiple codes for multiple descriptions (i.e. could be an emergency and a quote - so we need a 'like' expression somewhere in there I'm guessing).

Thanks so much.


I want to place Now() timestamp in a field when an operator hits a button, I would also like to tick a box.

Can anyone help with ideas

Thanks in advance

I am attempting to make a macro that will check data in a subform for a specific value.

The macro I have is:

[Forms]![Personal Data Entry with Senate and House]![Category Link Subform1].[Form]![Category ID]="FRI"

Message - Data Found




Message - Data Not found.

Ok. The macro works fine with one exception. The Category filed that is being searched may contain several records. I have encountered the following problem. If "Fri" is the only catagory that the person belongs to, the macro works fine. However, if the person belongs to several catagories, the statement returns as not true and I recieve the "data not found" message even if one of the catagories is "Fri." How can I eliminate this problem?

Thanks for any help you can give me.

Hi, I am a beginner MS Access user.

I use 5 "SendObject" actions in a Macro to send 5 reports in .rtf file type (report1.rtf , report2.rtf, etc..) to a recipient. This method results in multiple emails being sent to the recipient.

I am wondering if there is a way to attach all of the reports (*.rtf's) in a single email so that there will be only 1 email sent to the recipient. Any help is greatly appreciated.



Please can somebody advise me on the best way to count entries in a field to display on a report. The entries will not be known in advance so I need something that initially grabs the unique entries from a field and then performs a count on each of them.


I am trying to sum fields and group related records together (as in a report, but in an append query) so that I can place the resulting summarized data into another table. The sum functions get me field totals, but I cannot find anything that will allow me to total by groupings in a query. I am looking for something similar to the report groupings that work so well.

I have a field called STMTCODE that I want to group together all records with the same stmtcode. Then I want to sum all fields with the same STMTCODE into a single record in a different table.

Thanks to anyone that can assist.

Mark Gardner

Hey Everybody,

I would like to know if it is possible to send the value in a field via email.

Basically I would like to send only the ID number of a record to someone through lotus notes as an alert to open up Access and use that number to go to a specific record.

Thanks for everything.


On opening a continuous form based on a table which is an employees location history, I need to bring up a message if there are any dates in a field of the table that are over a year old and then i will run a delete query to remove them.
Have searched but found nothing and have tried a few ideas but to no avail.

Thanks in advance if you can help me?

I have a table that has our fiscal months with a BeginningDate and End Date that equals a fiscal month (for example, JAN 2013 - Beginning = 12/29/12, Ending Date is 2/1/13)

When a date is selected in a form, I want to reference this date in a query. I want my FiscalMonthTable to determine which fiscal month the date lies in. I then want to create a field that generates the BeginningDate for that FiscalMonth.

I will use this to determine the FiscalMonthToDate totals for a report. I know how to use DateSerial to get First of Month and First of Year, but I need our custom First of Fiscal Month and Fiscal Year.


I'm an old timer trying to teach myself access. I want to show the current date [=date()] on a form page and when the form is closed enter the date in a field of a record in a table. Everyday I want a new record to be created with the present date in it.


I am requesting if anyone could help me create an expression in the Validation section to prevent duplicate entries in a field. Please view Powerpoint file on slide 1 on attachment for More detail instructions. Instructions are in simple Text and images which makes it easy to understand. I am using Access 2003.

I will be waiting for your reply and thank you for your time.

Haleakala17 Attached Files (231.6 KB, 2 views) Last edited by Haleakala17; 09-11-2012 at 09:27 PM. Reason: I have attached mdb file Reply With Quote 09-11-2012, 03:59 PM #2 orange VIP Windows XP Access 2003 Join Date Sep 2009 Location Ottawa, Ontario, Canada Posts 4,207 To prevent duplicate entries -- make a unique index on the field involved.

Your question does not relate to validation section per se in my view. You need an index to prevent duplicate values,

Hello Everybody

I wasn't sure where I should post this, so I chose here. This is a Newbie question, but I am only able to enter 255 characters in a field. The DB I have created needs a place where the individuals can enter a description of the scene they are attending. Is it possible to go any higher? Should I be using something other than a text box?



Not finding an answer? Try a Google search.