473,324 Members | 2,548 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Insert Current Year in a field from a form

93
I have a form that when you hit a command button it moves the current year value (could be three years prior) to a previous year field. I need code to insert the current year in the current year field. I know this has to be simple but I just can't get it done.
May 8 '08 #1
2 8466
clloyd
93
I have a form that when you hit a command button it moves the current year value (could be three years prior) to a previous year field. I need code to insert the current year in the current year field. I know this has to be simple but I just can't get it done.

I got it
Expand|Select|Wrap|Line Numbers
  1.  helpfield = DatePart("yyyy", Now()) 
May 8 '08 #2
NeoPa
32,556 Expert Mod 16PB
Now() is fine, but Date() is probably the one you'd need.

Your code returns a string. The following returns the number. If putting into a TextBox control it would matter of course.
Expand|Select|Wrap|Line Numbers
  1. helpfield = Year(Date())
May 9 '08 #3

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

Similar topics

9
by: Martin | last post by:
Hello, I'm new with triggers and I can not find any good example on how to do the following: I have two tables WO and PM with the following fields: WO.WONUM, VARCHAR(10) WO.PMNUM,...
7
by: Fendi Baba | last post by:
The function is called from opencalendar(targetfield). Thanks for any hints on what could be the problem. .............................................................. var...
2
by: Nothing | last post by:
I have a form that a person enters some information on. They then clicka button that triggers VBA to perfom a SQL INSERT INTO query. One of the fields auto assignes the current date. Another...
4
by: john | last post by:
I have an unbound field in which I would like to show january 1 of the current year like this 01-01-2007. I tried this code but it doesn't work: =dateserial(Year(date()),1,1) Can someone help me...
1
by: deejayquai | last post by:
Hello I'm trying to append a series of values into fields from one table to another based on highlighted rows in a multi-select listbox. I'm stuck however when I need to append a couple of...
3
by: jomats | last post by:
I am a newbie trying to learn Access from several books. I'm sure this is an easy one to answer..for someone, not me. Is it possible to insert a checkbox on a form which, when checked, inserts the...
0
BenRatcliffe
by: BenRatcliffe | last post by:
Hi there, I was wondering if anyone could help me. I have a comlpex database with a number of forms that have data entered on them and then saved into the correct table etc. In this instance I am...
1
by: rdsandy | last post by:
Hi, I have a table Risk, a table Mitigation and a table RiskArchive. I am taking the RiskID, Criticality and MitigationPlan fields from Risk, and MitigationActionID from Mitigation and inserting...
58
by: bonneylake | last post by:
Hey Everyone, Well recently i been inserting multiple fields for a section in my form called "serial". Well now i am trying to insert multiple fields for the not only the serial section but also...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.