473,407 Members | 2,326 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,407 software developers and data experts.

date default value

29
Hi, i want to set a default value for a date field, and i want it to be 01/01/(current Year)
how would i go about doing this.
so if the current date is say 22/04/2007

i want the default value of a field to be 01/01/2007
Apr 22 '07 #1
3 9755
ADezii
8,834 Expert 8TB
Hi, i want to set a default value for a date field, and i want it to be 01/01/(current Year)
how would i go about doing this.
so if the current date is say 22/04/2007

i want the default value of a field to be 01/01/2007
In the Default Value Property for the Field:
Expand|Select|Wrap|Line Numbers
  1. =CDate("1/1/" & CStr(Year(Now())))
Apr 22 '07 #2
Shokoth
29
thank you for your help

I also wanted to know how to spread out sql statement over 3 lines.

I am writing an sql update statment in VB.

I have about 12 fields to update.

[code]
strSQL = "UPDATE [tblServiceUserPayments]" & _
"Set [tblServiceUserPayments].[January Payment] = DateSerial(Year(Date()),1,30), [tblServiceUserPayments].[JanPaymentRec] = False, [tblServiceUserPayments].[February Payment] = DateSerial(Year(Date()),2,28), [tblServiceUserPayments].[FebPaymentRec] = False " & _
"WHERE ((([tblServiceUserPayments].JanPaymentRec)= True) " & _
"AND (([tblServiceUserPayments].FebPaymentRec)= True));"
[code]

i have 10 more commands like that, and was wondering if it could be spreaded over several lines instead of one long line?
i have tried a few things, but they presented errors.
Apr 22 '07 #3
ADezii
8,834 Expert 8TB
thank you for your help

I also wanted to know how to spread out sql statement over 3 lines.

I am writing an sql update statment in VB.

I have about 12 fields to update.

[code]
strSQL = "UPDATE [tblServiceUserPayments]" & _
"Set [tblServiceUserPayments].[January Payment] = DateSerial(Year(Date()),1,30), [tblServiceUserPayments].[JanPaymentRec] = False, [tblServiceUserPayments].[February Payment] = DateSerial(Year(Date()),2,28), [tblServiceUserPayments].[FebPaymentRec] = False " & _
"WHERE ((([tblServiceUserPayments].JanPaymentRec)= True) " & _
"AND (([tblServiceUserPayments].FebPaymentRec)= True));"
[code]

i have 10 more commands like that, and was wondering if it could be spreaded over several lines instead of one long line?
i have tried a few things, but they presented errors.
It can be spread over several lines as long as you use the Line Continuation Character (_) and Concatenation Symbol (&).
Apr 23 '07 #4

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

Similar topics

0
by: Q. John Chen | last post by:
Using MySQL control center, I created a MySQL database table with a column of Date type. It always give the a Default value (0000-00-00) even null is allowed. I tried remove the default value and...
11
by: David Messner | last post by:
Ok I know this is simple but the statement eludes me... I have a date field where I want the default value on the data entry form's date field to be the last date entered. I figure I can do this...
1
by: Delatere | last post by:
Hello, can anabody help? in the following part i cannot pass de desired default value In the module of the mbd i declared: Global datum_Glo As String in a form (Dossier_FRM)i did
2
by: hyphen | last post by:
I have set up two date fields in a table: 1stpromisedDate and CurentPromisedDate The first field is to record the 1st promised delivery date of a supplier and the second is to record the...
1
by: Bob Day | last post by:
Using vs.2003 Using Server Explorer, Design Table, what can I put in the default field for a DateTime column? Obvious things like (#12/12/2003#) don't work. Please give me the answer...
12
by: Emi Lu | last post by:
Hello all, I have a question about "date" & "timestamp" types in PostgreSQL. I want to setup the default value '0000-00-00' and "0000-00-00 00:00:00" for them. However, it seems that PostgreSQL...
5
by: Jimmy | last post by:
How do I set the default value of a text box (date/time) to 1/1/Current Year... i.e 1/1/2006 this year, 1/1/2007 next year?
3
by: zufie | last post by:
I want to use SQL code to Create a Table & Provide a Default Value for Each Column. Here is the code I am using: CREATE TABLE customer (First_Name char(50), Last_Name char(50), Address...
7
by: sharmilah | last post by:
Hi all It's me again. I now want to specify the current date in the format '26/06/2007' ie date/month/year as the default value in my mysql database. Which implies that by default the value of my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
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
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...

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.