Remove blank space when copying code (1 Viewer)

access2010

Registered User.
Local time
Yesterday, 22:54
Joined
Dec 26, 2009
Messages
1,021
We are using the code in the attached Txt document to copy our internet passwords in MsAccess 2003.

When using the code a blank space is being copied and the passwords are not being accepted by the web site.

Could you suggest how we can change the code so that no blank spaces are copied?
 

Attachments

  • Copy_Passwords_Without_Blank_Space.txt
    982 bytes · Views: 39

June7

AWF VIP
Local time
Yesterday, 21:54
Joined
Mar 9, 2014
Messages
5,465
Blank space is where? In middle of password string?

Why are you using Text property instead of Value?

Really should post code directly in thread between CODE tags.
 

Cronk

Registered User.
Local time
Today, 15:54
Joined
Jul 4, 2013
Messages
2,771
Code:
Me.Vendor_Contacts_Password_Web= ltrim(rtim(Me.Vendor_Contacts_Password_Web))
will remove leading and trailing blanks
 

access2010

Registered User.
Local time
Yesterday, 22:54
Joined
Dec 26, 2009
Messages
1,021
Thank you for your note.
We use a hyperlink to connect to the website = Microsoft.com
Their website requires a user name = Bill
Their website requires a password = Gates

What code would you suggest to use to copy the data in the User Name and Password fields so that no blank spaces are copied?

The code that sometimes works is shown below.

===
Private Sub K_Vendor_Contacts_Password_Web_Click()
If Nz(Me.Vendor_Contacts_Password_Web, "") <> "" Then
With Me.Vendor_Contacts_Password_Web
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
End With
DoCmd.RunCommand acCmdCopy
'MsgBox "Text Copied into Memory"
Else
MsgBox "There is no text for copying"
End If
End Sub

===
I do appreciate your assistance
 

isladogs

MVP / VIP
Local time
Today, 06:54
Joined
Jan 14, 2017
Messages
18,209
Code:
Me.Vendor_Contacts_Password_Web= ltrim(rtim(Me.Vendor_Contacts_Password_Web))
will remove leading and trailing blanks

There's a typo in the above. Should be RTrim not RTim

But it can be simplified by just using Trim which removes both leading and trailing spaces
Code:
Me.Vendor_Contacts_Password_Web=Trim(Me.Vendor_Contacts_Password_Web)
 

June7

AWF VIP
Local time
Yesterday, 21:54
Joined
Mar 9, 2014
Messages
5,465
Didn't answer questions in post 2. Did you try suggestion in post 3?
 

access2010

Registered User.
Local time
Yesterday, 22:54
Joined
Dec 26, 2009
Messages
1,021
Thank you for your suggestion on removing blank spaces when copying.
I think I entered the correct code, for the copy command, but it is not working.
===
Private Sub K_Vendor_Contacts_Password_Web_Click()
Me.Vendor_Contacts_Password_Web = Trim(Me.Vendor_Contacts_Password_Web)
End Sub
===
Could you please advise me what I did wrong.

Thank you,
Cathy
 

Cronk

Registered User.
Local time
Today, 15:54
Joined
Jul 4, 2013
Messages
2,771
isladogs wrote
But it can be simplified by just using Trim which removes both leading and trailing spaces
Learn something new every day. Thanks Colin. Probably a carryover from dBaseIV
 

June7

AWF VIP
Local time
Yesterday, 21:54
Joined
Mar 9, 2014
Messages
5,465
You haven't yet said exactly where the blank spaces are. Maybe:

Replace(Me.Vendor_Contacts_Password_Web, " ", "")
 

access2010

Registered User.
Local time
Yesterday, 22:54
Joined
Dec 26, 2009
Messages
1,021
Thank you for your suggestion.
For all websites, except one your code works.
On the one web site that your code does not work at, I copy the data to a text document and than copy the data to the password field.

Thank you for trying to help us.
Linda
 

isladogs

MVP / VIP
Local time
Today, 06:54
Joined
Jan 14, 2017
Messages
18,209
It isn't clear which solution you tried:
- Trim will remove leading and trailing spaces but not those in the middle of a string
- Using the Replace expression will remove ALL spaces including those in the middle

Which password failed? Modify if necessary but keep the format the same. We don't need to know the site

BTW Out of interest, how many of you use the Access2010 username?
I've seen quite a few over a period of time including another name earlier that I responded to as well
 

access2010

Registered User.
Local time
Yesterday, 22:54
Joined
Dec 26, 2009
Messages
1,021
Thank you for your note.
I/We volunteer at a NGO (non profit charity) and all of us use the same Access2010 username.

(Which password failed?) Our log into our bank account is the only web account that does not accept your code.

Regards,
Nicole
 

isladogs

MVP / VIP
Local time
Today, 06:54
Joined
Jan 14, 2017
Messages
18,209
So did you use Trim or Replace in your solution?
I meant what type of password 'structure/layout' failed not what it is used for.
If you can tell us what's different about that password, we might be able to solve that....where does it have spaces, any non-alphanumeric characters?
 

access2010

Registered User.
Local time
Yesterday, 22:54
Joined
Dec 26, 2009
Messages
1,021
Thank you for trying to assist us.

Only our log into our Web Bank account fails.
The copied text is not accepted at our Bank Web Account, but is accepted at all other web accounts.

Mary Jane
 

isladogs

MVP / VIP
Local time
Today, 06:54
Joined
Jan 14, 2017
Messages
18,209
Yes I understood that with your previous answer.
Unfortunately as you aren't responding to my questions, i can't offer any further solutions for you
 

access2010

Registered User.
Local time
Yesterday, 22:54
Joined
Dec 26, 2009
Messages
1,021
Thank you for your suggestions.
We now only have one Web Site (our bank) that causes a small problem and we are working around this problem bu copying the User Name and Password to a text file and than to the Bank's Web site.

We appreciate your assistance.
Mahi
 

Users who are viewing this thread

Top Bottom