Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cannot copy data to include parentheses into Notepad

Status
Not open for further replies.

pellet

Programmer
Oct 23, 2008
55
US
Hi everyone,

First off, I would like to thank you all for taking the time to read my post. Without experts like you, working thru issues would be much more difficult than what it is.

My question is, have several databases linked together and I attempting to pull data out of one column in one of the tables and copy that data from that column in the table to Notepad. The number looks something like this: 123.45(1)(a) or something to that effect. I can pull the data from the column, but what I get when I write the data is 123.451a and two spaces after the last digit, which is (what I am guessing to be) the parentheses that I am missing. No matter what I try, I can't seem to copy and paste the parentheses even though they (the parentheses) show up on the table that I am copying from. If I manually cut and paste data from the table to Notepad, the parentheses show up just fine.

I have checked and I do not have any formatting of the data on the table. I have tried to format the column to include all data by using “” and also \, but no dice…

Any ideas are greatly appreciated. I have been working on this for quite some time now and I keep hitting a brick wall.

Thank you in advance.
pellet
 
What is the data type of the field in question?

You say "I can pull the data from the column, but what I get when I write the data". What do you mean by "pull" and "write"? Copy Paste, Export to file, other?

I know that you posted this already, but I am certain that the only way this could be happening if if there is an input mask or format on the field.

If you are doing a copy and paste, have you tried to build a query of the data and exporting it vice copy and paste?
 
Thank you for your reply

The data type in question is set to Text. I seem to have checked everywhere and I do not see any type of input mask or format on the field.

What I mean by pull is I create a variable in the code and then do a sendkeys command using that variable to the location I am attempting to write the data to. The program I am writing to is older, so I need to do some tabs and such in between fields, so I am doing that using sendkey. Then I just use sendkey to send my variable to the location that I tabbed to on my external program.

I have not tried to do a query for copy and paste - I can try that unless you read what I have above and have a better suggestion?
 
Hi Randy,

Here's a piece of the code in question. If I posted the whole thing, it would be multiple pages.

Private Sub cmdTransfer_Click()
On Error GoTo Err_cmdTransfer_Click
Dim Person1

Person1 = StrConv(Me.Per1, vbUpperCase)

AppActivate "Untitled - Notepad"

SendKeys "~"
SendKeys Me.txtAcctNum, True
'----------------------------------------------------
<SNIP IN CODE - A LOT OF TAB AND ENTER KEYS>
'----------------------------------------------------
SendKeys "{TAB}", True
SendKeys Person1, True
SendKeys "{TAB}", True

Me.cmdAcct2.SetFocus

Exit_cmdTransfer_Click:
Exit Sub

Err_cmdTransfer_Click:
MsgBox Err.Description
Resume Exit_cmdTransfer_Click

End Sub

When I try to send the Person1 variable via sendkeys is when the parentheses don't show up.
 
Why are you converting string to string?
Code:
    Person1 = StrConv(Me.Per1, vbUpperCase)

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Hi Skip,

Good question... I never thought of that - I just did it that way to convert it to uppercase letters.
 


Then try the UCase function NOT a CONVERSION.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
No, unfortunately... and I am getting ready to pull all of my hair out.
 
The answer is pretty simple, it is right in the help file.
The plus sign (+), caret (^), percent sign (%), tilde (~), and parentheses ( ) have special meanings to SendKeys. To specify one of these characters, enclose it within braces ({}). For example, to specify the plus sign, use {+}.

Dim myString As String
myString = me.txtAcctNum
myString = Replace(myString, "(", "{(}")
myString = Replace(myString, ")", "{)}")

 
P.S. your original post was so cryptic, no one could have helped. Your title was "Can not copy data to include parentheses into notepad", which has nothing to do with the problem and you had no mention of sendkeys. Please refer to the FAQ181-2886 on getting a good answer from Tek Tips. You wasted a lot people's time going down rabbit holes on a very simple issue.
 
For what purpose are you using Notepad? I am not questioning the correctness just want to understand why you chose Notepad. Exactly what are you trying to achive?

 
Hi MajP,

Thanks for your reply. I will try your suggestion to see if it works. I apologize for not adding in "using sendkeys" in the title - I know there are character limits in the title and I guess I really didn't realize the significance of how the variable was being passed.

Bubba100,

I am just trying to pass the parameter into Notepad to make sure it is not the external program I have to pass it to that would be causing the problem.

Thank you to everyone for your replies and your help.

 
It works. I tested your code, and then substituted mine. Your code will not send the special character "()", mine does.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top