Solved

Access Forms, VB Coding & Disabling Form Fields

Posted on 2008-10-27
2
455 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
2 Comments
 
LVL 84

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
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…

746 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now