Results 1 to 5 of 5
  1. #1
    Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Referencing IP address does not work.... (Excel 2002)

    I am not sure if this is the best place for this post but I am sure someone will tell me if it is not. I have enclosed a little snipit of code below that I am having problems with. I am in excel and I am trying to open an Access database. I am using XP - 2002 software. The IP address and path are correct (I have checked them a million times and had others check for me) so I know that is not the problem. When this code runs, it gets to the OpenDatabase(strDB) and won't work. There is no error message that is given. I have changed it to run from C: and the rest of the path and that works. I also have IIS running and have all the home directories set correctly. I ran this same code in Office 97/NT and had no problems. Any thoughts on why the IP will not work?


    strIP = Sheet1.Cells(102, 4)
    strExercise = Sheet1.Cells(97, 4)
    strTextPath = "" & strIP & "Exercises" & strExercise & "Text"
    strDB = "" & strIP & "Exercises" & strExercise & "MainProgramAAR_Date2.mdb"

    ElseIf intFileCount = 40 Then
    Set db = OpenDatabase(strDB)
    Set objAccess = CreateObject("Access.Application")

    Thanks

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Referencing IP address does not work.... (Excel 2002)

    No resolution, just an idea :
    Have you tried wrapping the full path and name in single quotes?

    strDB = "'" & strIP & "Exercises" & strExercise & "MainProgramAAR_Date2.mdb'"

    (look twice, the're there <g>)
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  3. #3
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Referencing IP address does not work.... (Excel 2002)

    Hi,
    I'm a little confused looking at your code as to what you're trying to achieve. The line
    Set db = OpenDatabase(strDB)
    should open a DAO workspace connection to the database in question to allow you to manipulate it in code (it would not be visible) but you are then opening an instance of Access too. Can you clarify what you're trying to do since I can't see anything syntactically wrong with the code. You should get an error if it couldn't find the database in question at any rate.
    Regards,
    Rory

    Microsoft MVP - Excel

  4. #4
    Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Referencing IP address does not work.... (Excel 2002)

    The way this has been working in the past is that strdb has an IP address with path to the database that I want to open. The database opens and there is a routine that runs in access and then it comes back to excel when it is done. This was all done in Office 97 and on Windows NT platform. Now when I am using a computer with XP and Office 2002 the same IP address does not work. It will however work if I put in C:and the path to the database. I don't get an error when it hits the OpenDatabase line it just jumps straight to the error routine we have in place. I don't know if it something with the way we have XP set up as opposed to NT. Don't know if this clears anything up or not.
    Thanks

  5. #5
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Referencing IP address does not work.... (Excel 2002)

    A couple of things to check:
    1. Try hardcoding the IP address into the OpenDatabase string and see if that works.
    2. Add a debug.print strIP line to verify that strIP is what you expect it to be.
    3. Turn off your errorhandler and see what error message you get - this may help narrow things down.

    I confess that without seeing the rest of the code I'm still a little unsure as to what you're doing exactly. Are you intending to use the OpenDatabase method of a DAO workspace or are you using the Workbooks.Opendatabase method? I presume you mean the DAO method, in which case do you have the correct references set? Is anything listed as MISSING: under Tools-References in the VBEditor?
    Regards,
    Rory

    Microsoft MVP - Excel

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •