Solved

Changing a fields control source based on the type on input

Posted on 2013-06-06
3
240 Views
Last Modified: 2013-06-06
Ok, so I have a SSN field.  Right now it displays correctly so that is not a problem.  But what I want the field to do is change it's control source based on whether a new record is being added our not.

Currently the control source displays like this:
="XXX-XX-"+Right([SSN],4)

This displays only the last four of a SSN

But when I add a record I want the control source to go blank, then on the after update I want the control source to display how it would normally.

Thanks
John
0
Comment
Question by:John Sheehy
[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
3 Comments
 
LVL 58

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 500 total points
ID: 39226098
John,

 In the forms OnCurrent event, do:

 If Me.NewRecord = True then
   Me.<myControlName>.ControlSource = "[SSN]"
Else
   Me.<myControlName>.ControlSource = "XXX-XX-"+Right([SSN],4)
 End If

Jim.
0
 

Author Comment

by:John Sheehy
ID: 39226289
Jim,

That worked.  Thank you very much.

John

PS still have the coin coming.  We had an issue with getting coins. Should be here next wednesday.
0
 

Author Closing Comment

by:John Sheehy
ID: 39226292
Great solution.  Quick and direct to the point.
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
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…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

728 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