0

Basically I have made a database that does all of my company's human resources needs. Now I have no training and everything has been learned from trial and error and/or looking up on the internet, but try as I might, I cannot find the answer to this question.

Basically on one of the forms to enter the personal information of an employee I enter their physical and mailing address. I have a check box that I would like to automatically fill the mailing address with the physical address if the checkbox is filled.

I have tryed the following in the coding area, but it will not work:

If MAILCHECK.text = 1 then MAILADDRESS.text = PHYSADDRESS.text
(I also had if 0 = " " ) ( (The MAILCHECK is the checkbox name, and the other two are the names of the text boxes from the table that need to be filled)

Truthfully this is purely cosmetic and doesn't hinder the database, but it is really annoying and not as perfect as I want it.

I hope I explained the problem well, and someone will have the knowledge to help me. Otherwise I have to keep pounding my head on the screen and having migraines! Thank you.

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by fieroheart
0

Try this:
On the AfterUpdate event of the check box, use this code:

Private Sub MAILCHECK _AfterUpdate()
  If Me.MAILCHECK Then
    Me.MAILADDRESS= Me.PHYSADDRESS
  End If
End Sub

This code will run after a user either checks or unchecks the check box. If the checkbox is checked, then MAILCHECK is true, so everything in the If block will run, which is to set the MAILADDRESS to the PHYADDRESS.

0

That did it, thanks!

Sorry for the late reply!

Is there a way to set it up that when the checkbox is unchecked the boxes fill with previous data? Like if someone accidentally clicked it and overwrote good date.

Thanks!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.