Solved

Access Forms, VB Coding & Disabling Form Fields

Posted on 2008-10-27
2
457 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

776 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