FREE Record Check Results
VIN: 2C1MR5295S6702239
Year/Make/Model: 1995 GEO METRO/LSI
Body Style: Sedan 4 DR
Engine Type: 1.3L L4 EFI SOHC
Manufactured In: CANADA
If I feed this URL into IE & launch it...
http://www.autocheck.com/consumers/gatewayAction.do?siteID=956&affid=CDT&vin=2C1MR5295S6702239
... the following appears in the browser window...
We found 6 record(s) for this vehicle
VIN: 2C1MR5295S6702239
Year: 1995
Make: Geo
Model: Metro
Style/Body: Sedan 4 Door
Engine: 1.3L I-4 EFI
Country of Assembly: Canada
Now, I could work with that data blurb much easier. Its already
parsed with CRLF's between each field of interest. The field names
are there already. Pretty much everything I want is there. I just
don't know how to capture it and feed it back to Access.
Suggestions???
If you can find a way for access to know where the file is saved or to save
it then I can help your read the file and parse it into a table. I just
dont know how Access knows how to access the file.
- Nicolaas
Do me a favor. Save it to c:\temp\datfile.txt
Thx.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
This simple class uses Microsoft.XMLHTTP.
There's a simple test sub below it.
<clsGetPageContent>
Option Compare Database
Option Explicit
Private mPageContent As String
Public Property Get PageContent() As String
PageContent = mPageContent
End Property
Public Sub requestPage(url As String)
On Error GoTo errHandler
Dim msXML As Object
Set msXML = CreateObject("Microsoft.XMLHTTP")
msXML.Open "GET", url, False
msXML.send
mPageContent = msXML.responseText
exitHere:
If Not msXML Is Nothing Then Set msXML = Nothing
Exit Sub
errHandler:
Err.Raise Err.Number, , _
"Error retrieving data from " & vbCrLf & url & vbCrLf & Err.Description
Resume exitHere
End Sub
Public Sub savePage(path As String)
Dim fh As Long
On Error GoTo errHandler
fh = FreeFile
Open path For Output As #fh
Print #fh, mPageContent
exitHere:
Close #fh
Exit Sub
errHandler:
Err.Raise Err.Number, , _
"Error writing to: " & path & vbCrLf & Err.Description
Resume exitHere
End Sub
</clsGetPageContent>
<test>
Sub test()
Dim gpc As clsGetPageContent
Set gpc = New clsGetPageContent
gpc.requestPage "http://www.autocheck.com/"
gpc.savePage "c:\temp\datfile.txt"
Set gpc = Nothing
End Sub
</test>
<clsGetPageContent>
...
</clsGetPageContent>
usage. Is that syntax for creation and setup
of a user-defined type? Should I put everything
between those 2 strings in a global module, or
will a form module do?
clsGetPageContent would be the name you give to the class module
--
[OO=00=OO]
Public Type clsGetPageContent
var1 As Variant
var2 As Long
var3 As Integer
var4 As Currency
var5 As Variant
End Type
... I would imagine.
Sorry, that's just my lameass way of indicatiing the start, end
and name of code that belongs in the same class or code module.
Copy the text between the two markers above and paste it into a
class module. Save it and name it clsGetPageContent.
Copy and paste the text between the other two markers into a
code module. Place the cursor at the beginning of the Sub test()
method and hit F5 to run it. You should end up with a
c:\temp\datfile.txt file with the contents of the web page at
http://www.autocheck.com/
I know that this is an Access forum, but would this be the same in VB
6?
Thanks.
> I know that this is an Access forum, but would this be the same in VB
> 6?
Yes indeed. Do a search on Microsoft.XMLHTTP and you will find many
examples.
Dim gpc As clsGetPageContent is the problematic
line.
Did you put the clsGetPageContent code in a class module
named clsGetPageContent?
Not a module. A Class module.
If you're really stumped by this, just do a Google search
for Microsoft.XMLHTTP.
Is that how I was supposed to create the class
module???
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
O.K. Forget the class. Put the following in a click
event of a button on a form and click the button.
'---------
Dim msXML As Object
Dim strPageContent as string
Dim fh as Long
fh = Freefile
Set msXML = CreateObject("Microsoft.XMLHTTP")
msXML.Open "GET", "http://www.autocheck.com/", False
msXML.send
strPageContent = msXML.responseText
Open "c:\temp\datfile.txt" for Output as #Freefile
Print #fh, strPageContent
set msXML = Nothing
Close #fh
'---------
Thanks!
Tom
"MLH" <CR...@NorthState.net> wrote in message
news:bqk1a1duanvhgvl1s...@4ax.com...
Sorry I couldn't figure out the stuff
regarding the class module you gave
me the first time. Just now making
the leap from Access 2.0 to 97.
Dunno much about class modules
yet. But U fixed my prob - that's
for sure. Man, you're a genius.
Thx.
Here's a break down of the parts of the code you need to
understand.
'declare an variable of type object
Dim msXML As Object
'declare a variable of type string
Dim strPageContent as string
'create an XMLHTTP object
Set msXML = CreateObject("Microsoft.XMLHTTP")
'open a connection and send a request for a web page
'via two methods of the XMLHTTP object
msXML.Open "GET", "http://www.autocheck.com/", False
msXML.send
'a successful request returns the page content and the
'XMLHTTP object stores the content in it's responseText
'property.
'here the responseText is stored in the local strPageContent
'variable so the XMLHTTP object can be desposed of
strPageContent = msXML.responseText
'despose of the XMLHTTP object
Set msXML = Nothing
You now have a string variable with the entire contents of
the web page in memory. Assuming you understand the concept
of variable scope, you can do whatever you want with it.
You don't have to write it to a file. You don't need to fuss
with the clipboard to manipulate it. Just use it.
In this case you will need to search the variable for the
text you want to display. It turns out the section of the
file you're looking for is de-limited by comment tags.
<!--START VEHICLE DESCRIPTION-->
<!--END VEHICLE DESCRIPTION-->
Hope you understand that.
Good luck with the rest of the task.