Solved

Need to pull last 4 digits from an entered field and store this info in the form and in the table

Posted on 2006-06-26
11
333 Views
Last Modified: 2011-10-03
New employees are entered into our Access database through an Employee Form.  The last 4-digits of their SSN is used as their Payroll number.  I would like to have the 4 digits automatically stored in the Employee table and displayed on the Employee form to avoid an individual mis-keying this information.  
I have limited Access knowledge so an easy to implement solution would be welcome.
A very quick response would be appreciated since we need this field for a Payroll conversion we are performing.
0
Comment
Question by:PJ_KD
  • 5
  • 3
  • 3
11 Comments
 
LVL 61

Assisted Solution

by:mbizup
mbizup earned 300 total points
ID: 16985793
Rather than storing this as an additional field... you already have the full ssn:

- Set up a text box on your form /report named txtPayrollNumber
- In the textbox's property window, control source property:
= Right([YourSSNFieldName], 4)

(include the = sign.)
0
 

Author Comment

by:PJ_KD
ID: 16985942
I had tried this and for some reason the Right function is being rejected as an unacceptable function to use in the Control Source Property.  It was also not accepted in an Update Query.
I also would like to store this 4 digit value in the Table so that I can export the table contents to an Excel spreadsheet that is then imported into our payroll system.
0
 
LVL 13

Assisted Solution

by:lucas911
lucas911 earned 200 total points
ID: 16986043
If you are getting an error using this function, then you probably have some references missing or active X objects are not registered properly.

View your source code then click on tools->references and see which ones are missing and re-click them if need be.
0
 
LVL 61

Accepted Solution

by:
mbizup earned 300 total points
ID: 16986531
As lucas911 suggested, check your references.

To update a table field with the last four SSN digits from your form, set up a textbox bound to payrollnumber, and use this code in the afterupdate event of the textbox where SSN is entered:

Private sub txtSSN_Afterupdate()
   me.txtPayrollNumber = Right(me.txtSSN,4)             '** Replace with your control names as needed
End Sub

This will take care of new and changed records.  You will need an update query, as you'd mentioned to extract the last four digits of your existing SSNs into a new field.
0
 

Author Comment

by:PJ_KD
ID: 16987350
Although the Right function should work, even after checking all of the references that could be checked, the Right function is not being recognized.  This database is Access 97 and Right should work, but I can't find what else to check.  I will keep looking.
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 13

Expert Comment

by:lucas911
ID: 16987379
Exit your DB.  The go to START->Run - copy and paste:

regsvr32 C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\VBE6.DLL

0
 
LVL 13

Expert Comment

by:lucas911
ID: 16987524
0
 

Author Comment

by:PJ_KD
ID: 16987571
I have scanned the C: drive and the Office 97 installation disk and the VBE6.dll file is not present.  I will look on Microsoft's web site and see if there is something that I can download. Thank you for your ongoing comments.
0
 

Author Comment

by:PJ_KD
ID: 16987724
I am looking at the link that you referenced and will see if that helps.  I will be back in touch.
0
 

Author Comment

by:PJ_KD
ID: 17103911
Thanks for both of your assistance.  It took me a while to figure out that I had some extra references that were preventing the "Right" function from working.  After the References in the Module area were set correctly, your help resulted in the resolution of my issue.

Many thanks.
0
 
LVL 61

Expert Comment

by:mbizup
ID: 17116179
Glad to help out.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
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…

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