Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / July 2007

Tip: Looking for answers? Try searching our database.

SetValue with Formatting

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
F1stman - 13 Jul 2007 16:28 GMT
Hello All,
I have a field in my database called Account#. Despite the name, there are
times when Account# is actually descriptive text. For this reason, normal
formatting or an input mask will not work to properly format the numerical
Account #'s. Formatting must be like so: @@-@@-@@ (or for "1234567890",
"12-34-56-78-90"). Please note that the real account# is 29 numbers so there
is not chance of accidental formatting of text.

Is there a way that I can set script on the lost focus action for the text
box where the data is entered such that dashes are inserted and the value is
saved in the table with dashes?

I have tried fancy IF functions with Formatting and InputMask adjustments
but this only solves the problem on the form and leaves report Account#'s
unformatted.
Below is what I have tried so far.

***
Private Sub Account_Code3_LostFocus()
If Me.Account_Code3 Like "#############################" Then
Me.Account_Code3.InputMask = "##-##-#-######-########-##-######-##"
End If
End Sub
***

Many thanks in advance.
Adam Kemp
SteveM - 13 Jul 2007 17:50 GMT
The problem you are having is really a product of bad design. You should not
use a field to store such inconsistent data, especially a field such as
Account#.
You would be better to create another field. In fact, you should probably
have another table for non-account accounts...

Steve

> Hello All,
> I have a field in my database called Account#. Despite the name, there are
[quoted text clipped - 23 lines]
> Many thanks in advance.
> Adam Kemp
F1stman - 13 Jul 2007 18:20 GMT
I am working within the constraints of an already existing system for the
department I am designing this for. For a number of reasons they need this
data to be stored in the same table. Thanks for the help.

> The problem you are having is really a product of bad design. You should not
> use a field to store such inconsistent data, especially a field such as
[quoted text clipped - 31 lines]
> > Many thanks in advance.
> > Adam Kemp
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.