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

Exporting Data to a internet form

Status
Not open for further replies.

hartwell

Technical User
Apr 18, 2005
80
GB
We are looking for users to fill in a form within Access and with a click of a but it will open a webpage, transfer the data over to the relevant fields and click submit,

I have tried searching the forms but no luck, could you please point me in the right direction or so me an example for submitting a search on google so i can work from that?

Cheers

 
hartwell,
Here are a couple of simple examples. Both pages take the fields from the webpage and encode them into a [tt]GET[/tt] request that is sent to the server. In both cases I am using VBA code to replicate that request, and reverse engineered it from the string that appears in the address bar of IE/Firefox (with a little review of the validation scripts from the individual web pages).
Code:
Sub OpenGoogleSearch(SearchString As String)
Const sBaseAddress As String = "[URL unfurl="true"]http://www.google.com/search?"[/URL]
Const sLanguage As String = "hl=en&"
Const sQuestionStart As String = "q="
Dim strGet As String
'Replace the spaces
strGet = Replace(SearchString, " ", "+")
Shell "C:\Program Files\Internet Explorer\iexplore.exe " & sBaseAddress & sLanguage & _
      sQuestionStart & strGet
End Sub

Sub OpenYahooHistoricQuoteWeekly(Ticker As String, StartDate As Date, StopDate As Date)
Const sBaseAddress As String = "[URL unfurl="true"]http://finance.yahoo.com/q/hp?"[/URL]
Dim strGet As String
strGet = "s=" & Ticker & "&"
strGet = strGet & "a=" & Month(StartDate) - 1 & "&"
strGet = strGet & "b=" & Day(StartDate) & "&"
strGet = strGet & "c=" & Year(StartDate) & "&"
strGet = strGet & "d=" & Month(StopDate) - 1 & "&"
strGet = strGet & "e=" & Day(StopDate) & "&"
strGet = strGet & "f=" & Year(StopDate) & "&"
strGet = strGet & "f=" & "g=w"
Shell "C:\Program Files\Internet Explorer\iexplore.exe " & sBaseAddress & strGet
End Sub

NOTE: On the Google example I only pulled the logic for a text search and only replaced the spaces.

Hope this helps,
CMP

(GMT-07:00) Mountain Time (US & Canada)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top