Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Access Forms, VB Coding & Disabling Form Fields

Posted on 2008-10-27
2
Medium Priority
?
464 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 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

721 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