format of Form field that allows data to be copied without format

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a Fed-x tracking form that we enter the in/out bound Fed-x's (sending
out portfolios to ad agencies). I want the Fed-x # to be formated when
entered and displayed in the form but if I highlight & copy it to track at
web site I don't want the "format" to be included. Here is an example:

As I enter the field I would get xxxx-xxxx-xxxx, where x is a blank space.
After number is entered it would display as 1234-5678-1234
Now if I highlight and copy the number I would get 123456781234 - no dashes
in the copied number.

Is this possible to do??

Ken gehle
 
Hi Ken,

yes

if the number is stored as text, you can use the InputMask property and
choose to include or not include the placeholder symbols

0000-0000-0000;;_

For data that already has the dashes stored, you can use an Update query
to remove them

UPDATE Tablename SET [fieldname] = Replace([fieldname],"-","");

Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 
Not doing a copy/paste. When you copy, you are copying the text in the
control, so it will include all characters. copy/paste is a Windows thing,
and you can't get around that in Access.

I do have an alternative idea, if it helps. Here is a little test routine I
wrote that works. What it does is strip out the dashes in the control, copy
the contents of the text box to the clipboard, and restores the original
value of the text box.

So create a command button on your form with the following code in it.
change the names as needed.

So when you want to copy the unformated value to the web site, click on the
command button, then go to the web screen and do a paste.

Private Sub Command5_Click()
Dim strOriginal As String

Me.Text0.SetFocus
strOriginal = Me.Text0
Me.Text0 = Replace(Me.Text0, "-", "")
Me.Text0.SelLength = Len(Me.Text0)
DoCmd.RunCommand acCmdCopy
Me.Text0 = strOriginal
Me.Text0.SelLength = 0
End Sub
 
Hi Klatuu,

"Not doing a copy/paste"

thanks, I didn't realize that... looks like a nifty little procedure...

just out of curiosity, why do you do this:

Me.Text0.SelLength = Len(Me.Text0)

Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 
That selects the content of the control so the copy command will copy it;
otherwise, there would be nothing in the copy buffer.
 
thanks, Klatuu!

Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 
You are welcome.

I don't know if there is another way to do that. It is the first idea I
had. It just seemed like an interesting problem.
I will usually have disparaging remarks when people start talking
copy/paste, but this is a unique circumstance where is seems to make sense.
 
Back
Top