Question

Locked

How do i auto fill in web site submission forms from access?

By arjei ·
I have created a database in Access that I want to automatically fill out submission forms on the internet. An example would be if I have to fill out an unblock request for Comcast, i want to simply click a button and have it fill it out and submit it for me. Is this possible in access?

This conversation is currently closed to new comments.

8 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Yes this is possible

by Slayer_ In reply to How do i auto fill in web ...

But you will need to be an expert in VBA.

You will have to use a combination of sendmessage (or postmessage) API calls, and the sendkeys command to send your data to a live web page.

Collapse -

So I cant build through a macro or expression?

by arjei In reply to Yes this is possible

Do you recommend building this in visual basic, or is there a way to build this through access as an expression or macro?

Collapse -

you could do either

by Slayer_ In reply to So I cant build through a ...

Either would work.

Collapse -

You mind hooking me up with an example?

by arjei In reply to you could do either

I really would like for this to work. I have been researching this all day. If you could give me an example of how to create this I would be greatly appreciative.

Collapse -

well its not fool proof however

by Slayer_ In reply to You mind hooking me up wi ...

there are several ways. First to decide, do you want to do it thru access or a VB6 program?


Second, how do you want this to be triggered? Keep in mind you can only type to what you can see. The easiest way, send keys, would rely on everything on screen being the same every time, and that your cursor was at the same position every time, and that the browser window is in focus.


If it were me, I would make a timer that checks for a key press, say F12, when detected, it would run through a sseries of send keys commands, based on text from the database. The user would have to be sure they have the browser window in focus at the time, and their cursor in the correct box.

Would this solution be acceptable to you?

Collapse -

Yes

by arjei In reply to well its not fool proof h ...

The part I am confusing myself over is how to link my command button to the website I want to go to. I know how to hyperlink the button, but that doesnt seem to be working with the macro I built. I tried to use the runapp command and it is telling me my path name is incorrect. If I just hyperlink the button, can i skip the run app portion of the macro and go directly to the send keys portion?

Collapse -

Easy

by Slayer_ In reply to Yes

First, what browser do u want to use?

Let's assume for now your using IE

call shell("iexplore.exe http://www.google.ca")

that line of code will fire up internet explorer and pass it googles web address. However, that line of code does not "Wait" for IE to launch, it just sends the command to the system. There is no good way to wait for a program to launch. I have done it using getwindow commands, and I would just loop them until it finds a window. Once the window is found, assumably the program is running. But even then, there would be no way to tell when the web page was loaded. A sleep command would be best for that, just sleep it for, maybe 5 seconds after it knows the browser is loaded.


code to describe how I said I check for open programs would look like this. *next post, for clairity*

Collapse -

Code post

by Slayer_ In reply to Yes

Option Explicit
Private Declare Function FindWindow& Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String)
Private Declare Function GetForegroundWindow Lib "user32.dll" () As Long
Private Declare Sub Sleep Lib "Kernel32" (ByVal dwMilliseconds As Long)


sub main 'or whereever u want this
dim h1 as Long
dim h2 as long

do while h1& = 0& 'search for as long as it is not found
call doevents 'Allow windows to do other stuff, rather than crazy looping
h1& = FindWindow("IEFrame", "Google - Windows Internet Explorer") 'Look for the IE window on the correct page, if not found, returns 0, thus loop again
loop

'Give it a moment to let the page open
call sleep(5000) '5 second wait.

'now check if the window you found, is actually the one in focus
h2& = GetForegroundWindow
if h1& = h2& then
'we're good, do what you need to do
else
'it's open, but its not up front, send keys won't work
end if

end sub

Back to Networks Forum
8 total posts (Page 1 of 1)  

Related Discussions

Related Forums