Solved

Changing a fields control source based on the type on input

Posted on 2013-06-06
3
235 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
  • 2
3 Comments
 
LVL 57

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
No matter the version of Windows you are using, you may have some problems with Windows Search running too slow or possibly not running at all. Before jumping into how you can solve this issue, just know there are many other viable alternative deskt…
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…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

747 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