473,568 Members | 2,939 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Compare user entered date to date in table

tuxalot
200 New Member
I have a textbox, [Date of Injury] on [FrmMain] with a record source [TblEmployeeInju ry]. FrmMain is a tabbed form showing injury data for a given EmployeesID. I have a textbox, [Start Date] on a subform [FrmMain].[FrmDateHistory] with [TblDateHistory] as the record source. [Start Date] is entered by a user and saved to the table by clicking a save button on the subform. Both date entries are in Short Date format and entered by Date Pickers. I would like an On Click event to fire when the save button is clicked which would compare if [Date of Injury] and [Start Date] are equal. No other comparison is required. If they are equal, I would like a MsgBox to show, and after the MsgBox is closed the set focus would return to [Start Date].

I'm very new to Access so hopefully someone can assist with this.

Any help is very much appreciated!
Feb 27 '09 #1
2 2395
puppydogbuddy
1,923 Recognized Expert Top Contributor
Add the following code to the end of the existing code for your save button.


'______________ _______________ _______________
Expand|Select|Wrap|Line Numbers
  1. If Me.[StartDate] = Me.Parent.[Date of Injury] Then
  2.     MsgBox "Your message."
  3.     Me.[StartDate].SetFocus
  4. End If
Feb 27 '09 #2
tuxalot
200 New Member
Thanks pup! I appreciate the fast response.

Tux
Feb 27 '09 #3

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

Similar topics

2
2816
by: Renie83 | last post by:
Hi I really am going crazy! I'm using VBScript, ASP, and SQL My page reminds me of a shopping cart but looking at shopping cart examples has not helped! What I have is a page that brings in products ordered by a certain company. Along with those values, I'm creating a text box at the end of each record that a user may or may not enter in an...
9
3921
by: Rich | last post by:
Thanks for the Help in my previous post. I've been working on this and it's almost what I want. I want to obtain the user's current age by comparing their date of birth (user inputs) to the current date. I know how to get the Current Date but I'm not finding how to calculate the Current Date minus the User's Birthday.
6
2497
by: Robin S. | last post by:
**Eric and Salad - thank you both for the polite kick in the butt. I hope I've done a better job of explaining myself below. I am trying to produce a form to add products to a table (new products). Tables: tblCategoryDetails CategoryID SpecID
5
10857
by: Megan | last post by:
Hi everybody- I'm helping a friend with a music database. She has an old one and is creating a new one. She wants to compare records and fields in the old database with records and fields in the new database. For instance, her old database has a table with Band Info in it. Her new database also has a table with Band Info in it but slightly...
7
31805
by: James P. | last post by:
Hello there, In my asp.net page using VB, I have a date text field in mm/dd/yyyy format. When a date is entered, I'd like to validate it to make sure the date is greater than or equal to the current date. If not, I'd like to display the error message to ValidationSummary. It seems to make sense to me to use CompareValidator but the...
2
1720
by: deancarstens | last post by:
Hi, I'm a novice with VB and I've written this pretty simple script, but for the life of me, I can't get the last bit of the script to work. It should compare the value entered by the user under the BeforeUpdate event and compare it to the value in the main form. It's doing that just okay, but when I want to reset the value using the...
4
4150
by: ghjk | last post by:
I want to compare user entered date with data base datetime value. Database value in datetime type and first i want to extract date part and then compare with user entered value. This is my query. Could someone tell me what is wrong with it? SELECT * FROM db WHERE Date = SELECT CAST(Date AS DATE) AS dateonly FROM db
2
1591
by: AlfredoAMD | last post by:
So I've been working on this for over a week now and I'm still totally stumped. Basically I receive a sales report weekly which has several fields such as "Opportunity # (Unique)", "Planned Close date", "Sales Phase", and others... From this data I use excel to calculate a few things: "setback in planned close date" (by comparing the current...
482
27423
by: bonneylake | last post by:
Hey Everyone, Well i am not sure if this is more of a coldfusion problem or a javscript problem. So if i asked my question in the wrong section let me know an all move it to the correct place. what i am trying to display previously entered multiple fields. I am able to get my serial fields to display correctly, but i can not display my...
0
7693
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...
0
8117
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...
1
7660
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...
0
7962
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...
1
5498
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
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...
0
3651
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...
1
2101
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
0
932
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.