Copy from field to filed on a form (1 Viewer)

johannaellamay

Registered User.
Local time
Tomorrow, 06:06
Joined
Jul 19, 2014
Messages
190
Hi! I have a table and form for employees. I have two address, one is current, and the other one is permanent. On my form, I want to have a checkbox that says "Current address is the same as permanent address." By clicking that, I want to copy the data on the current address field to the permanent address field. I have looked online for solutions and found this code:

Code:
Private Sub check_EmployeeAddress_Click()

Me.eCurrentAddress1 = Me.ePermanentAddress1

End Sub

But everytime I run my form and click the checkbox, it just deletes the data on current address and does nothing on my form.

Help please? :confused:
 

sparc

Registered User.
Local time
Tomorrow, 00:06
Joined
Jul 29, 2013
Messages
18
Try me.permanentaddress1 = me.currentaddress1
you copy vice versa from empty field to the filled field
 

johannaellamay

Registered User.
Local time
Tomorrow, 06:06
Joined
Jul 19, 2014
Messages
190
Oh my gosh a million thanks! That was so simple it's embarrassing. Hahaha! Again, thank you. ;)
 

johannaellamay

Registered User.
Local time
Tomorrow, 06:06
Joined
Jul 19, 2014
Messages
190
Okay now I have another problem. So I already know how to copy the data. But how do I reverse it? For example the user made a mistake and wants to just delete permanent address. So he/she could unclick the checkbox to do that. But how do I write the code? :confused:
 

sparc

Registered User.
Local time
Tomorrow, 00:06
Joined
Jul 29, 2013
Messages
18
Private Sub check_EmployeeAddress_Click()

if me.check_EmployeeAddress then
Me.eCurrentAddress1 = Me.ePermanentAddress1
else
Me.ePermanentAddress1 = ""
end if

End Sub
 

Users who are viewing this thread

Top Bottom