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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do you Enter Text into a webpage(InternetExplorer obj) textbox 1

Status
Not open for further replies.

NocturnalPimp

Programmer
Jun 17, 2004
2
CA
I was wondering, how one would enter text from an access database...or text of any kind from anywhere into a textbox in a webpage. I created an obj, InternetExlorer.Application. It opens a window and loads the page. from there I want it to enter into User Login textbox (on the webpage), a username I have stored in a database...the same goes for the password field. Is this possible?

Thanks!!
 
To allow a user to enter in Username and Password into a webpage:
Code:
<input type="text" name="UserName" size="20" maxlength="50" value="">
<input type="password" name="Password" size="20" maxlength="50" value="">
But I think you are wondering how to check against the database to make sure the username and password is correct. To do this you will have to use a programming language (eg. ASP, ColdFusion), create a connection to the database (ADO, DAO), write a query.
I hope I understood your questions and I hope this helps.
ksbigfoot
 
I don't think I explained my question well enough. Thanks for a reply though!

Let me try once more....in Access, I created a form with one button and a MS Web Browser (OLE. When the button is clicked, it opens an Explorer window and goes to a website. (i created an InternetExplorer.Application object and used the nagivate2 method). On the webpage, there is a textbox to enter an ID.

What i want to do (my question)----> I want to be able to take a field of "IDs" and enter it into the box.

i.e. click button, page loads, data from record is automatically inputted into the webpage's according ID textbox, submit, startover for the rest of the records.

I might be confusing "webpage's textbox"....an example of that would be when ur on hotmail and you want to login...you have the textbox for your email address.

Hope that makes people understand my question!!

Thanks again!
 
Try something like this maybe... It works for me. I had a fun time exploring the InternetExplorer Object... Get to know it well, as you can use it to do all sorts of neat things.

Code:
[blue]Private Sub[/blue] cmdLogin_Click()
[blue]On Error GoTo[/blue] err_catch

[blue]Dim[/blue] obIE [blue]As Object[/blue]
[blue]Dim[/blue] vURL, vLogin, vKey, stDocName, stLinkCriteria [blue]As String[/blue]

stDocName = "frmWebLoad" 
[green]'A simple pop-up form that says "Website Loading"[/green]
vURL = "[URL unfurl="true"]http://www.yourwebsite.com"[/URL] 
[green]'Your Website URL [/green]
vLogin = "login" 
[green]'Your Username for the site.[/green]
vKey = "password" 
[green]'Your Password for the site.[/green]

DoCmd.OpenForm stDocName, , , stLinkCriteria

[blue]Set[/blue] obIE = CreateObject("InternetExplorer.Application") 
[green]'Creates the IE object[/green]

obIE.Navigate (vURL) [green]'Self explanitory[/green]

[green]'Wait while site loads.[/green]
[blue]While[/blue] obIE.Busy = [blue]True[/blue]
  DoEvents
[blue]Wend[/blue]

[blue]With[/blue] obIE.Document
    .all.Item("username").Value = vLogin 
    [green]'Item names such as "username" and "password"
    'come from the source of the website.[/green]
    .all.Item("password").Value = vKey   
    .Forms(0).submit [green]'Self explanitory.[/green]
[blue]End With[/blue]

[green]'Wait while site processes information[/green]
[blue]While[/blue] obIE.Busy = [blue]True[/blue]
  DoEvents
[blue]Wend[/blue]

[green]'Kill popup form and display page.[/green]
DoCmd.close A_FORM, stDocName
obIE.Visible = [blue]True[/blue]

[blue]Set[/blue] obIE = [blue]Nothing[/blue]

[blue]Exit Sub[/blue]

err_catch:
    Msgbox ("Error Number " & Err.Number & ".  " & Err.description)

[blue]End Sub[/blue]

I stuck explanations in the code... hope this helps someone out there. When looking for the input names in the page's source code, watch for something like this:

Code:
      <tr>
       <td width="40%" align=right>USERNAME:</td>
       <td width="60%"><input type="text" name="username"></td>
      </tr>
      <tr>
       <td width="40%" align=right>PASSWORD:</td>
       <td width="60%"><input type="password" name="password"></td>
      </tr>
      <tr>

Have fun!

--Thenolos
 
Hi Thenolos!

I was sure I had posted thanks to you in this thread already, but it seems not...so thanks. You have saved me a bundle of time.

Regards,

Peter



Remember- It's nice to be important,
but it's important to be nice :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top