Solved

How do I late bind MS XMl, v6.0 in MS Access 2007?

Posted on 2013-01-19
6
925 Views
Last Modified: 2013-02-01
I have a function the retrieves the users IP address from a web site. The problem is, for this to work I would have to add a reference to Microsoft XML, 6.0 (msxml6.dll). I do not want to do that as it will cause problems with deployment. I don't not completely understand late binding be it sounds like what I am looking for.

Private Sub GetUserIP_Click()
    Dim strIP As String
    Dim strText As String
    Dim lngPos1 As Long
    Dim lngPos2 As Long
     
    Dim httpReq As New MSXML2.XMLHTTP60
    ' fetch the data
   
    httpReq.Open "Get", "http://www.whatsmyip.us", False
    httpReq.send
    strText = httpReq.responseText
    ' find the location of the IP address in the response
    lngPos1 = InStr(strText, "Your IP is:")
    ' calculate the position of the first digit
    lngPos1 = lngPos1 + 99
    ' find the location of the closing tag
    lngPos2 = InStr(lngPos1, strText, "<")
    ' extract the IP
    strIP = Mid(strText, lngPos1, lngPos2 - lngPos1)
    ' report to user
    MsgBox strIP
End Sub
0
Comment
Question by:seanlhall
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 34

Accepted Solution

by:
Norie earned 500 total points
ID: 38796398
Replace this,
Dim httpReq As New MSXML2.XMLHTTP60

Open in new window

with this.
Dim httpReq As Object

    Set httpReq = CreateObject("MSXML2.XMLHTTP60")

Open in new window

0
 
LVL 77

Expert Comment

by:peter57r
ID: 38796451
Just to be sure you're clear on one point...(sorry if this is grandmother and eggs )
Using late binding doesn't mean that you avoid using that dll.  It just means that Access doesn't care which version of the dll is installed.
0
 

Author Comment

by:seanlhall
ID: 38797220
I made the changes but got the following error.

Run-time error '429'
ActiveX componet cant create object.
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 

Author Comment

by:seanlhall
ID: 38797253
I got it to work. I change it to this:

Dim httpReq As Object

 Set httpReq = CreateObject("MSXML2.XMLHTTP") 

Open in new window

0
 
LVL 34

Expert Comment

by:Norie
ID: 38797306
Sorry about that, forgot to leave out the 60 part.

I think that indicates the version.
0
 
LVL 84
ID: 38798057
You also must be sure to use ONLY those components of that library which are available in the user's version. As  peter indicates, Late Binding will help if you're not sure what VERSION you're dealing  with, but it doesn't absolve you of some due diligence regarding syntax and versions. If you're sure that all users are running at least Version4.0 of a library, for example, you can make sure your code is compliant with 4.0 - which means you can't make use of features introduced AFTER Version 4.0. If you have no idea what version your users will be running, then you must be sure to make it compliant with ALL versions of the library (which means no new features introduced after Version 1)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question