473,725 Members | 2,180 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Access 2003: Date restrictions

23 New Member
Hi guys,

I have a couple of questions about date restrictions.
On one of my forms in my DB I have the MS calendar. The question I have is how do I prevent the user from selecting a date in past and from selecting no more than 45 days into the future. Example today is 12/08/06, I would like to prevent the user from selecting 12/07/06 and unable to select anything pass 01/22/06. Hope that makes sense.

Second part of my questions is I have another form which the source is from a table. In this table there is field which contains dates. The dates are appointments that are setup. On this form you are able to see the appointments from the past and those that are scheduled in the future. I would to restrict the form from showing appointments in the future. If the form is accessed today I would like for it to only show appointments for today and those in the past.
Any help or reference anyone can provide would be greatly appreciated.
Dec 8 '06 #1
3 2699
NeoPa
32,569 Recognized Expert Moderator MVP
I have a couple of questions about date restrictions.
On one of my forms in my DB I have the MS calendar. The question I have is how do I prevent the user from selecting a date in past and from selecting no more than 45 days into the future. Example today is 12/08/06, I would like to prevent the user from selecting 12/07/06 and unable to select anything pass 01/22/06. Hope that makes sense.
In the BeforeUpdate event of the control put in some code that checks the control is between today and today +45.
Expand|Select|Wrap|Line Numbers
  1. Private Sub CtrlName_BeforeUpdate(Cancel As Integer
  2.     If Me.CtrlName < Date() _
  3.     Or Me.CtrlName > Date() + 45 Then
  4.         Call MsgBox("Invalid Date")
  5.         Cancel = True
  6.     End If
  7. End Sub)
Second part of my questions is I have another form which the source is from a table. In this table there is field which contains dates. The dates are appointments that are setup. On this form you are able to see the appointments from the past and those that are scheduled in the future. I would to restrict the form from showing appointments in the future. If the form is accessed today I would like for it to only show appointments for today and those in the past.
Any help or reference anyone can provide would be greatly appreciated.
Set record source of the form to
Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM [table] WHERE [yourdatefield] <= Date()
Dec 8 '06 #2
JC21
23 New Member
Thank you NeoPa, it worked!
Dec 11 '06 #3
NeoPa
32,569 Recognized Expert Moderator MVP
Thank you NeoPa, it worked!
No Probs (Don't sound so surprised).
Dec 11 '06 #4

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

Similar topics

23
2688
by: JustMe | last post by:
I don't know if this has anything to do with AccessXP running on Terminal Services with Access97/2000 also installed, but here is one example of a query that does not work any longer: SELECT DLookUp("MajorCategory","AutoTypes","='1'") AS MajorCategory, PreOwned.PaintColor FROM PreOwned; When I try to run the above query I get the following error:
4
2542
by: JMCN | last post by:
object invalid or no longer set - confusion of the recordset in access 2003. i am currently converting from access 97 to access 2003. majority of the codes converted over perfectly fine, though my recordset did not. i read from pasts posts that some references will not convert. so i tried to change the dao 3.51 reference to dao 3.6 in access 97. then i imported all of the objects into an access 2003. it did not work. so my second...
35
3219
by: deko | last post by:
Do I get more scalability if I split my database? The way I calculate things now, I'll be lucky to get 100,000 records in my Access 2003 mdb. Here some math: Max mdb/mde size = 2000 x 1024 = 2,048,000k Let's say on average each record in the database consumes 15k 2,048,000/15 = 136,533 records
47
4537
by: ship | last post by:
Hi We need some advice: We are thinking of upgrading our Access database from Access 2000 to Access 2004. How stable is MS Office 2003? (particularly Access 2003). We are just a small company and this is a big decision for us(!) It's not just the money it's committing to an new version of Access!
4
2541
by: RM | last post by:
Had VS .Net 2002 installed on W2k Server SP3 and supported a number of web sites. Installed VS .Net 2003 on Friday and now all web sites using .Net & MS ACCESS get this strange error upon open. ASP=/TestDotNet/AdoNet.aspx System.Data.OleDb.OleDbException: Unspecified error at System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) at System.Data.OleDb.OleDbConnection.InitializeProvider() at System.Data.OleDb.OleDbConnection.Open()...
5
1177
by: Calvin X | last post by:
hi everyone, this may seem like a dumb question but here goes. I developed an asp.net app, works great, uploaded to production server and it works when tested from this server. But when I try to access the app from another machine (connecting to the server) I get the page cannot be found page. I tried: servername/appname ip address/appname
2
1638
by: piyush1.mehta | last post by:
I am new to MS Access database and want to accomplish following. I have a database and report in MS Access 2003. There are multiple users who wants to access and generate their respective reports (self help). Because of certain license restrictions they can not access 2003 installed on my PC. We have a shared drive with 2002 installed on it. I wanted to accomplish a connection between Access 2003 (my PC) and MS Access 2002 (shared...
2
1371
by: goodlie | last post by:
Hello; I have an access 2003 db on XP OS split with backend on sql2K. I want to put the front end on a fileserver for easier maintenance. I have 7 users using the database at any given time. We are experience locking issues. When multiple users are in database they cannot save their edits. and sometimes users are locked out of the database by ADMIN. If I put the database front end on the users local drives, there are no
3
3850
by: Sheldon | last post by:
I have the following query expression - Like Format((!!)) & "/*/" & (! !) which would translate to e.g. 04/*/2007 if someone is running a report for last month. The above expression is part of a Where clause for a date field. It works fine in Access 2000 and pulls out the appropriate # of records but in Access 2003, this expression (apparently) evaluates differently and no records are extracted. Is this an area that might've changed...
0
8888
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
8752
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
9401
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9257
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...
1
9176
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8097
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
6011
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2635
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.