Link to home
Start Free TrialLog in
Avatar of Crabbula
CrabbulaFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Access Forms, VB Coding & Disabling Form Fields

Hi,
When using my Access Database in form mode, I'd like the fields "C1 Address", "C1 Postcode" & "C1 Home Phone" to be disabled when the checkbox "C1 same as YP?" is checked. The problem I'm facing is that the code I have works, but it then disables these fields on ALL records not just that specific record.

Here's what I have so far:

Private Sub C1_same_as_YP__AfterUpdate()
  If Not (Me.C1_same_as_YP_) = False Then
      Me.C1_Home_Phone.Enabled = False
      Me.C1_Address.Enabled = False
      Me.C1_Postcode.Enabled = False
  Else
      Me.C1_Home_Phone.Enabled = True
      Me.C1_Address.Enabled = True
      Me.C1_Postcode.Enabled = True
   End If
End Sub

Also once those fields have been disabled, I'd like them to clone information from fields "Home Address", "Post Code" & "Home Phone", so these details are displayed but editable.

Any help on these matters would be much appreciated.
Thanks in advance,
Crabbula
ASKER CERTIFIED SOLUTION
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Crabbula

ASKER

Hi, Yes I'm viewing the records in a continouous form with Previous and Next Record buttons.

I have pasted the same coding without the very first line into the Current event and thats worked a treat thank you very much.

I just need to find out the second part of my question now, how to clone information to these disabled fields...
I