I have a form with a combo box called "cmbWebsites".
The combo box row source comes from a select query that returns rows:
0.WebsiteID
1.Website Name
2.Website URL
3.Username
4.Password
Only "Website Name" appears in the combo box. The other columns are set to zero length.
When the user selects a website, the AfterUpdate event will trigger code to build a string that contains the URL, Username and Password of the selected website, and runs it through the FollowHyperlink method.
The only thing I don't know how to do is format the hyperlink so the websites will accept the username and password and automatically get me into the site; like "Roboform".
Even though this isn't a pure MS Access question, I can't imagine that other Access developers haven't done something similar.
Does anyone know how to format a URL with Username and Password, so the FollowHyperlink method automatically gets you into the site?
Thanks,
Adam
@AdamOnAccess
Just change your declaration for your elements (strUNtag, etc.) like so:
dim strUNtag
Don't try to add quotes or anything. Do not declare it as string or anything. Or leave out the declarations completeley and it will work.
cheers,
12 5382 @AdamOnAccess
I guess that would depend on the format that the Web site requires. For instance I have a map button for my addresses and I open a google map to display my contacts driving directions. The string I send to google maps is based on their format.
I also retrieve stock and index indormation from numerous sites but they require me to pass a string in a certain syntax.
All you need to figure out is what syntax the site expects and do something like so: -
Dim strURL As String
-
strURL = "http://maps.google.com/maps?q=" & txtAddrStreet & ",+" & txtAddrCity & ",+" & txtAddrProv & "+" & txtAddrPostal & "+" & txtAddrCountry
-
Application.FollowHyperlink strURL
-
cheers,
mshmyob,
Thanks for the reply. I know I need the format, but I was thinking that perhaps there was some kind of "standard" for usernames and passwords. Are you familiar with the program, "Roboform". It maintains usernames and passwords for any site you choose. Just click a button, and it stores the URL, username and password. When you want to return to the site, you just click it and in you go. How does Roboform manage to send usernames and passwords to ANY website without first knowing the format?
There must be some standard way to do this. Any one know how?
-Adam
NeoPa 32,556
Expert Mod 16PB
I'm not familiar with RoboForm Adam, but from your own description, it seems that it holds it per site. I expect it determines the format from usage somehow (and stores it with your username and password in its database). I certainly think (no great expert at this to be sure so don't take as gospel) that Mshmyob is on the right lines with this though.
I will try and look into it this weekend. I have done a little research and thrown something together but I am having a few errors. Give me a couple of days and I will see what I can come up with if anything.
cheers,
I'm not sure of the specific syntax, but you may be able to use the ExtraInfo Parameter of the FollowHyperlink Method to accomplish this.
@AdamOnAccess
Just retrieve the Username and Password Control Names as well as the Form Name from the Web Site (View Source), and you should be OK: - Dim objIE As Object
-
Set objIE = CreateObject("InternetExplorer.Application")
-
-
With objIE
-
.Visible = True
-
.Navigate "<Your Web Site>"
-
-
Do While .ReadyState <> 4
-
DoEvents
-
Loop
-
-
With .Document.Forms(0)
-
.UserName.Value = "your login" 'Retrieve Control Name from Web Page
-
.Password.Value = "your password" 'Retrieve Control Name from Web Page
-
.Document.loginForm.submit 'Retrieve Form Name from Web Page
-
End With
-
End With
I've developed some code that is slightly convoluted, does not require advance knowledge of any Control/Form Names, and actually worked very well during many trials. It involves the use of the FollowHyperlink Method, SendKeys, and the Sleep() API Function. You can judge for yourself: - Declare the API Function:
- Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
- Execute the following code block:
-
Const conWEB_ADDRESS As String = "<YaDa, YaDa, YaDa>"
-
Const conUSERNAME As String = "<more YaDa, YaDa>"
-
Const conPASSWORD As String = "<still more YaDa, YaDa>"
-
-
Application.FollowHyperlink Address:=conWEB_ADDRESS
-
-
Sleep (3000) 'Delay 3 seconds
-
SendKeys conUSERNAME, True 'Plug in User Name
-
-
Sleep (1000) 'Delay 1 second
-
SendKeys "{TAB}", True 'Send the TAB Keystroke
-
-
Sleep (1000) 'Delay 1 second
-
SendKeys conPASSWORD, True 'Plug in Password
-
-
Sleep (1000) 'Delay 1 second
-
SendKeys "{TAB}", True 'Send the TAB Keystroke
-
-
Sleep (1000) 'Delay 1 second
-
SendKeys "{ENTER}" 'Send the ENTER Keystroke
NOTE: You can experiment with the Delays for better performance.
Here is a simple way of submitting your username and password to various sites. -
' you need a reference to the Microsoft HTML Object Library
-
Dim webBrowser As Object
-
Set webBrowser = CreateObject("InternetExplorer.Application")
-
-
With webBrowser
-
.Navigate "put your login URL here"
-
.Visible = True
-
' loop until the page has finished loading
-
Do While webBrowser.readyState <> 4
-
DoEvents
-
Loop
-
' username and password are the default element names - if they are different you need to figure them out and change accordingly
-
.Document.all.Item("USERNAME").Value = "your username"
-
.Document.all.Item("PASSWORD").Value = "your password"
-
End With
-
cheers,
Mshmyob, ADezii, NeoPa,
Thanks all! Lot's of great stuff to work with here. My biggest problem now is deciding which solution is best? It seems the real tricky part here is capturing the object names for username and password in the html form. I suppose I could create fields in the database to store that info, use view page to capture the actual names, and then slug them in when I run the code.
Not the kind of thing I'd expect most users to pull off. I could set "Username" and "Password" as default field names and that will probably cover most of it.
Thanks again!
-Adam
ok, I got pretty far with it but than got hung up at the last moment. Here's what is happening... - With Me!cmbWebSiteID
-
strURL = .Column(1)
-
strUNtag = .Column(3)
-
strUNtag = Chr(34) & strUNtag & Chr(34)
-
strPWtag = .Column(4)
-
strPWtag = Chr(34) & strPWtag & Chr(34)
-
strMyUN = .Column(6)
-
strMyPW = .Column(7)
-
strSubmitButton = .Column(5)
-
strSubmitButton = Chr(34) & strSubmitButton & Chr(34)
-
End With
-
-
-
Dim webBrowser As Object
-
Set webBrowser = CreateObject("InternetExplorer.Application")
-
-
With webBrowser
-
.Navigate strURL
-
.Visible = True
-
' loop until the page has finished loading
-
Do While webBrowser.readyState <> 4 Or webBrowser.Busy
-
DoEvents
-
Loop
-
' username and password are the default element names - if they are different you need to figure them out and change accordingly
-
.Document.All.Item(strUNtag).Value = strMyUN
-
.Document.All.Item(strPWtag).Value = strMyPW
-
.Document.All.Item(strSubmitButton).Click
-
End With
-
When I run the code, I get this error message...
"Method 'Item' of Object 'NameOfForm' Failed"
The error occurs on this line:
.Document.All.Item(strUNtag).Value = strMyUN
if I remove the variable and run it as a fixed string like this...
.Document.All.Item("Nick").Value = strMyUN
... with "Nick" being the actual name of the Username field on the HTML page, the code works perfectly.
Does anyone know how I can get it to run with the variable?
Thanks,
Adam
@AdamOnAccess
Just change your declaration for your elements (strUNtag, etc.) like so:
dim strUNtag
Don't try to add quotes or anything. Do not declare it as string or anything. Or leave out the declarations completeley and it will work.
cheers,
Works great! Thanks MshMyob!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: |-|erc |
last post by:
Hi!
Small challenge for you.
The index.php uses this file and calls layout(). Take a look at www.chatty.net this file
draws the chat login box on the right. I traced the CHAT button it submits...
|
by: rikesh |
last post by:
Hi
I'm sure this is a very trivial problem!
I have a combo bound to a recordset. I was wondering how I can show the
value on the page, what the user has selected?
The code that I'm using is...
|
by: hlabbott |
last post by:
Hi
I'm having a problem displaying attachments correctly. I have
messages with attachments stored on Exchange2000 and want to be able
to click a hyperlink in my project like in OWA and see an...
|
by: Patrick |
last post by:
I have an ASP.NET application that connects to a SQL Server database.
The SQL Server resides on a seperate development server from the IIS5.1 on
Windows XP SP2 on development PCs which host the...
|
by: hary08 |
last post by:
im doing a database for Hospital Admission, I have a log in form which prompt user for a password. The source of log in is to look for the values in my Table tblEmployees and match user name and...
|
by: SFM |
last post by:
I just want a simple datareader, that i can read the value returned
from a select statement executed on a SQL server 2005 db.
The code below should work in, but email= rdr.ToString();
when i...
|
by: jambonjamasb |
last post by:
Hi
I have two tables:
email_tbl
Data_table
Data table is is used to create a Form
Data_form
|
by: Faisal Shah |
last post by:
As the solution.. I have got this script code.. it's an open source so i can modify it..
The problem is it's a guest book script written in very highly and deeply php language that I am not able...
|
by: tokcy |
last post by:
HI every one,
i am using tooltip on click of link and i want like when that tooltip open then background window would be blure().
can anyone help me...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |