473,796 Members | 2,720 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 1450
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******@pcdata sheet.com
www.pcdatasheet.com
"merlin" <ma*******@gmai l.com> wrote in message
news:11******** *************@c 13g2000cwb.goog legroups.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(txtDat e As Access.TextBox) As Boolean

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

Dim strGetDateMessa ge As String

Dim strGetDateError As String

Dim dteDate As Date

Dim strDate As String

On Error GoTo Err_Proc

strDate = txtDate

If IsNumeric(strDa te) 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(strDa te) 'cdate could also be used

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

txtDate = DateValue(strDa te) '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."

strGetDateMessa ge = MsgBox(strGetDa teError, 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
6081
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 the bottom of every PHP page. The board should have just the basic features, like: - posting capability
3
3702
by: Patchwork | last post by:
Hi Everyone, Please take a look at the following (simple and fun) program: //////////////////////////////////////////////////////////////////////////// ///////////// // Monster Munch, example program #include <list>
8
6507
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
2069
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 unstructured (no nested sections). And is not really very simple. Before trying to setup a stripped-down document format by myself, I would like to know if there are simple XML document structure proposals ready to be used (I dislike to reinvent the...
11
2717
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
2105
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 of the string cannot increase either (no more than 14 chars) and must be numeric only.
7
2289
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 that page like http://machinename/dir1/hellp.aspx instead of running that page it starts downloding ...whats missing here ....why the aspx engine not running the page....
24
6342
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 have on his site, a Javascript Calculator for working out the cost of what they want, for example: 1 widget and 2 widglets = £5.00
14
2990
by: Giancarlo Berenz | last post by:
Hi: Recently i write this code: class Simple { private: int value; public: int GiveMeARandom(void);
10
2140
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 System.Web.Services Imports System.Web.Services.Protocols Imports System.ComponentModel <System.Web.Services.WebService(Namespace:="http:// wwwpreview.#deleted#.co.uk/~ptaylor/Customer.wsdl")_
0
9673
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9524
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10217
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10003
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9047
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5440
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5568
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4114
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 we have to send another system
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.