• Status: Solved
  • Priority: Low
  • Security: Public
  • Views: 103
  • Last Modified:

Access 2013 library reference for Jim Dettman's tcpip.accdb

I had this question after viewing MS Access VBA--Check if there's an internet connection..

I downloaded Jim's Access database for pinging (tcpip) but most of the code is red.
I guess i'm missing a library reference.
Using Access 2013. Can someone recommend a reference?
0
Philip Wright
Asked:
Philip Wright
  • 10
  • 6
  • 2
3 Solutions
 
als315Commented:
May be you have placed code into wrong type of module? It should be in class module.
Look at sample with form
TCPIP.accdb
0
 
Philip WrightAuthor Commented:
Reply to als315 - I just opened the Access database (TCPIP.accdb) and went to the VBA code module.
It is not a class module in TCPIP.accdb - so I think I'm missing a reference to some dlls.
All the 'Private Declare Function' lines at the head of the module are red.
So I guess it's not finding wsock32.dll , kernel32, icmp.dll etc.
0
 
als315Commented:
Do you have 64 bit Access version?
0
Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

 
Fabrice LambertFabrice LambertCommented:
what's in red ?

Is it all the "Declare Function" statements ?
If so, it looks like a 32b vs 64b issue.

on 64b environment, these declaration should be written with ptrsafe and longptr statements whenever they use pointers.
0
 
Philip WrightAuthor Commented:
Yes
Current references (under Tools in the VBA window) are:
Visual Basic for Applications
Microsoft Access 15.0 Object Library
OLE Automation
Microsoft Office 15.0 Access database engine object
Microsoft XML, v6.0 (I just added this - do I need it?)

I'm pretty new to MS Access. Do you recommend any other references?
0
 
Philip WrightAuthor Commented:
Thanks, Fabrice.
I changed 'Private Declare Function' to 'Private Declare PtrSafe Function' and all the lines changed to black.
I should have realized this as I've encountered it once before - a while ago.

Does anyone recommend additions/deletions/changes to my library references?
I'm still a Newbie!
0
 
Fabrice LambertFabrice LambertCommented:
To my knowledge, the first 3 references are required.

The last 2 can be optional.
Remove one, see if your code still compile, if not, turn it back on.
Since you're a VBA rookie, that's the best thing for you.
0
 
Philip WrightAuthor Commented:
Thanks, everyone:
als315 - The 'Run' button in your TCPIP.accdb database returns 'Internet down' even though it clearly isn't - because I'm typing this.
The code in the form looks pretty basic. So I guess I'll have to do more troubleshooting. Lotsa fun!
Cheers
0
 
Philip WrightAuthor Commented:
Re: TCPIP.accdb
Looks like the error occurs on number of available sockets.

If WSAD.wMaxSockets < MIN_SOCKETS_REQD Then
    sErr = "This application requires a minimum of " & _
            CStr(MIN_SOCKETS_REQD) & " supported sockets."

    SocketsInitialize = False
    Exit Function
End If
0
 
Philip WrightAuthor Commented:
Does anyone actually have this TCPIP.accdb running on a 64 bit system?
I haven't had any luck.

WSAD.wMaxSockets returns zero no matter what I try.
How do I populate this?
0
 
als315Commented:
Sorry, I have no 64bit Access and can't test. Can you show your code? May be we will be able to find error in declaration
0
 
Philip WrightAuthor Commented:
To als315 - I haven't written any code on this as yet. I merely downloaded your copy of TCPIP.accdb
I went through the class module and added PtrSafe to all the declarations at the head. Then I substituted LongPtr for Long.
That's it.
The code runs fine but wMaxSockets always returns zero, as if there were no sockets left. I even ran 'netsh winsock reset' in a command window in case Windows had actually run out of sockets.
I'm attaching a copy of my revised module, however. Maybe I made some dumb error in my substitutions.
ocsTCPIP.txt
0
 
als315Commented:
Try an alternate version of connection check (alternate run button)
TCPIP.accdb
1
 
Philip WrightAuthor Commented:
To ALS315 - Cool! I copied my adjusted declarations into the head of this module and it all works!
Thanks very much for your help and support. And patience!
0
 
als315Commented:
You are welcome
1
 
Philip WrightAuthor Commented:
To als315 - Actually, when I checked your added code, I see you're not using the original module, just the simple code in the new module.
So I didn't need to alter the code in the original module, just delete the module.
Again, thanks.
I clearly need to do more research of my own in this area. But - do you know offhand if there's any security or other downside to using the code in your second module. Is the code in the original ocsTCPIP module more secure?
0
 
als315Commented:
I see no difference in security of both codes. Both use OS functions
1
 
Philip WrightAuthor Commented:
Thanks everyone, and especially als315, for all your help on this. Much appreciated!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

  • 10
  • 6
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now