UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Validating a Date and using a MsgBox    
 
   
RustyThuesen
post Mar 25 2005, 11:48 AM
Post #1

New Member
Posts: 9



Hi:

I was hoping someone could assist me with validating date information. I have a database that tracks complaints. Basically, there are two date fields, one for the date the complaint was received, and one for the date the Investigation was completed. As I am looking through the 4600 records in this database, I am seeing that there are approximately 160 records that have a complaint received date that is after the Investigation completed date.

I would like for the data entry clerks to receive a message box that tells them this "The Investigation Completed Date must be greater than the Complaint Received Date". This should occur after they entered the Invvestigation Completed Date and it is prior to the Complaint received date...

Can anyone tell me where this should be done and how changing this will affect the data already in the database?

Many thanks!

Rusty
Go to the top of the page
 
+
ScottGem
post Mar 25 2005, 11:55 AM
Post #2

UtterAccess VIP / UA Clown
Posts: 25,090
From: LI, NY



In the AFTER UPDATE event of the Completion date control use:

IF Me!txtCompDate < Me!txtOpenDate Then
MsgBox "Competed Date cannot be earlier then Open Date!", vbOkOnly
Me!txtCompDate = Null
Me!txtOpenDate.SetFocus
Me!txtCompDate.SetFocus
End If

Note,, you can't Set Focus if the control already has focus, but once the After Update is completed it would change the focus, that's why I set the focus to another control first. The result should be that after they press OK on the message, the date they entered will erase and they will be back in the control.

HTH
Go to the top of the page
 
+
RustyThuesen
post Mar 25 2005, 12:11 PM
Post #3

New Member
Posts: 9



THanks! When I put that code in I received the following message:

The expression AfterUpdate you entered as the event property setting produced the following error: Ambiguous name detected: print_Click.

I double checked the spelling and spacing, so I am not sure what happened.

Rusty
Go to the top of the page
 
+
ScottGem
post Mar 25 2005, 12:20 PM
Post #4

UtterAccess VIP / UA Clown
Posts: 25,090
From: LI, NY



Did you enter it as a Code expression? It sounds like there is already a click event module with a similar name.
Go to the top of the page
 
+
RustyThuesen
post Mar 25 2005, 12:29 PM
Post #5

New Member
Posts: 9



Yes, I entered it as a code expression. Where would I look to see if there is a click event module? When I look at the modules tab, it is empty. When I look through all the codes, I do not see one for the Investigation Completed Date other than the one I just wrote.

Pardon my ignorance, I have inherited several problem databases that were developed by other people and am having a heck of a time fixing some of them. I am just a little frustrated at this point; not to mention I am somewhat of a newbie to the whole development part of Access.

Thanks!

Rusty
Go to the top of the page
 
+
ScottGem
post Mar 25 2005, 01:34 PM
Post #6

UtterAccess VIP / UA Clown
Posts: 25,090
From: LI, NY



What is the name of the module?

Should be Private Function controlname_After_Update or something like that.

Do a search thru the whole project for print_click.
Go to the top of the page
 
+
RustyThuesen
post Mar 25 2005, 03:25 PM
Post #7

New Member
Posts: 9



The search produced about 5 different codes with print_click contained in the code...

After looking further into the structure of the database, it really needs a lot of work.

I am going to drop this discussion and delve even further into the database. I thank you for your help! Rest assured, I will be asking lots of questions along the way.

There isn't even a consistent naming convention in the tables....Oh my...

Rusty
Go to the top of the page
 
+
ScottGem
post Mar 25 2005, 03:55 PM
Post #8

UtterAccess VIP / UA Clown
Posts: 25,090
From: LI, NY



good luck
Go to the top of the page
 
+
RustyThuesen
post Mar 28 2005, 01:51 PM
Post #9

New Member
Posts: 9



Hi:

Hope everyone had a nice Easter! Thanks for all your assistance. I have another question on this database, but I will post it in the correct forum.

Rusty
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 24th May 2013 - 01:46 AM