473,513 Members | 2,266 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

simple one

greetings to all. i am new to the group and to access. I am using
access 97 to setup our clinic's database and in one of the tables I
need to be able to type in a date only in terms of the Month/Year
format? How do I do that? I can't seem to be able to find this either
through the help file or with playing around with the properties. I
know it's a silly one but we all have to start from as low as this lol
:)

thanks in advance

yanni

Nov 13 '05 #1
4 1437
Use separate textboxes to enter the Month and Year then use the DateSerial
function to convert that to a date. Look up DateSerial function in the Help
file.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"merlin" <ma*******@gmail.com> wrote in message
news:11*********************@c13g2000cwb.googlegro ups.com...
greetings to all. i am new to the group and to access. I am using
access 97 to setup our clinic's database and in one of the tables I
need to be able to type in a date only in terms of the Month/Year
format? How do I do that? I can't seem to be able to find this either
through the help file or with playing around with the properties. I
know it's a silly one but we all have to start from as low as this lol
:)

thanks in advance

yanni

Nov 13 '05 #2
thanx but doesn't that complicate things? the thing is that for some of
the things i want to record (ie. onset of episodes) there are no
specific dates (ie. 10/01/05 ) the patient usually reports approximate
data mid jan 05 - so my idea is to simply record month and year...i am
playing with this format at the moment mm:yy but it does funny things
when i try to type in the data like that 01/05 for example...

y

Nov 13 '05 #3
On 18 Jan 2005 07:28:35 -0800, merlin wrote:
thanx but doesn't that complicate things? the thing is that for some of
the things i want to record (ie. onset of episodes) there are no
specific dates (ie. 10/01/05 ) the patient usually reports approximate
data mid jan 05 - so my idea is to simply record month and year...i am
playing with this format at the moment mm:yy but it does funny things
when i try to type in the data like that 01/05 for example...

y


Enter the year with 4 digits. 2005, not 2.

If you do not use an input mask, you can enter the month and year (as
a 4 digit year). Access will default to the first day of that month,
i.e. enter 2/2005 and Access will store 2/1/2005. However, if the
user enters a 2 digit year, i.e. 2/05, Access will assume 2/05/2005.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #4
merlin wrote:
thanx but doesn't that complicate things? the thing is that for some of
the things i want to record (ie. onset of episodes) there are no
specific dates (ie. 10/01/05 )


It would still be best to record the year as well. You can always use
month() and year() functions to get that sort of thing.

Now, if you want to just enter month/day or whatever, here is a function
I use frequently, developed in A97. If you use this in a later version
of Access, drop the @@ in the msgbox text. I use this in the after
update event of a text box, allowing me to enter enter a single number,
which the function interprets as a day of the current month/year, or a
month/year which the function interprets as the current year. If you're
ambitious, you can fiddle around with text values and use it in a before
update event, but after update works for me. References to "FM EPS" are
to a specific app I pulled this from.

Please watch the wrap, I'm just plopping this down into this message:

Function fGetDate(txtDate As Access.TextBox) As Boolean

'Used to get proper date format in the after update event. Must be used
with a text box

Dim strGetDateMessage As String

Dim strGetDateError As String

Dim dteDate As Date

Dim strDate As String

On Error GoTo Err_Proc

strDate = txtDate

If IsNumeric(strDate) Then 'if only numbers, then insert slash

Select Case Len(strDate)

Case 1, 2 'if numeric and only one or two, interpet as day

strDate = Month(Date) & "/" & strDate & "/" & Year(Date)

Case 3, 4 'at least two numbers, then interpret first two
as month, after as day

strDate = Mid(strDate, 1, 2) & "/" & Mid(strDate, 3) &
"/" & Year(Date)

Case Else

strDate = Mid(strDate, 1, 2) & "/" & Mid(strDate, 3, 2)
& "/" & Mid(strDate, 5)

End Select

End If

'strDate = DateValue(strDate) 'cdate could also be used

'if the above works, then everything is fine otherwise error 13

txtDate = DateValue(strDate) 'this will raise an error 2115 if it
doesn't work

fGetDate = True

Exit_Proc:

Exit Function

Err_Proc:

Select Case Err.Number

Case 13

strGetDateError = "Date entered improperly @@" & _
"There are a number of formats you may use:" & vbCrLf
& vbCrLf & _
"1. Numbers and slashes, eg, MM/DD/YY (or YYYY),
M/D/YY" & vbCrLf & vbCrLf & _
"2. Name of a month (3 or more letters) day, year (in
any order) with spaces or commas between" & vbCrLf & vbCrLf & _
" eg, 12 Apr 1999, Apr 2000 12, April 1, 99,
etc" & vbCrLf & vbCrLf & _
"(for 1 & 2, if the year is left out, the current year
will be assumed)" & vbCrLf & vbCrLf & _
"3. Numbers with no delimiters:" & vbCrLf & _
"* 1 or 2 numbers is day (current month & year added
by FM EPS)" & vbCrLf & _
"* 3 or 4 numbers is month/day (current year added by
FM EPS)" & vbCrLf & _
"* 5 to 8 numbers will be interpeted as month/day/year."

strGetDateMessage = MsgBox(strGetDateError, 0 + 64,
"Improper Date Format")

txtDate = Null

fGetDate = False

GoTo Exit_Proc

End Select

End Function
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "What's UP, Dittoooooo?" - Ditto
Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
6066
by: delisonews | last post by:
I'm looking for a simple, filesystem-based message board. (No MySQL!) Something that I could include easily in my code: include '../inc/messageboard.php'; .... so that the board shows up at...
3
3663
by: Patchwork | last post by:
Hi Everyone, Please take a look at the following (simple and fun) program: //////////////////////////////////////////////////////////////////////////// ///////////// // Monster Munch, example...
8
6480
by: Dan | last post by:
Using XML::Simple in perl is extreemly slow to parse big XML files (can be up to 250M, taking ~1h). How can I increase my performance / reduce my memory usage? Is SAX the way forward?
6
2049
by: Manuel Collado | last post by:
I would like to write simple, yet well structured documents with a really simple XML DTD (or schema). Either Docbook or SDocbook are overkill for this simple case. XHTML is simpler, but...
11
2676
by: JKop | last post by:
Take the following simple function: unsigned long Plus5Percent(unsigned long input) { return ( input + input / 20 ); } Do yous ever consider the possibly more efficent:
4
2087
by: Steven Blair | last post by:
I have the following number: 64521234567890 and need to apply some sort of simple encryption. Does c# have any classes for doing this. I cant use 3DES or anything as complex as. The size...
7
2265
by: abcd | last post by:
I am trying to set up client machine and investigatging which .net components are missing to run aspx page. I have a simple aspx page which just has "hello world" printed.... When I request...
24
6288
by: firstcustomer | last post by:
Hi, Firstly, I know NOTHING about Javascript I'm afraid, so I'm hoping that someone will be able to point me to a ready-made solution to my problem! A friend of mine (honest!) is wanting to...
14
2961
by: Giancarlo Berenz | last post by:
Hi: Recently i write this code: class Simple { private: int value; public: int GiveMeARandom(void);
10
2108
by: Phillip Taylor | last post by:
Hi guys, I'm looking to develop a simple web service in VB.NET but I'm having some trivial issues. In Visual Studio I create a web services project and change the asmx.vb file to this: Imports...
0
7265
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
7171
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
7388
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7539
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
5095
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
4751
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
3240
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...
0
1605
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 ...
0
461
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.