Solved

Access Forms, VB Coding & Disabling Form Fields

Posted on 2008-10-27
2
462 Views
Last Modified: 2013-11-28
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
0
Comment
Question by:Crabbula
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 22817703
You probably need to put this same code in the Form's Current event ... this fires each time the form moves to a new record.

Are you displaying this in a continuous or datasheet form?
0
 

Author Comment

by:Crabbula
ID: 22817818
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
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

634 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question