Resolve Web Address error in SQL

I am attempting to access images on a server.  The address are all in the same string format, however one piece of the address could be upper case or lower case

Example: http://webaddress/image/12345AN.gif might be
http://webaddress/image/12345AN.gif or might be http://webaddress/image/12345an.gif

Is there a way through VBA to evaluate the first address, and if it returns the 403 Error, than to use the second address?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You have to perform the request and check the response status, then query for the other.
Http_tequest.  Not sure how your question dealing with SQL.

A web you would use a client side script to load the image in the background and display the one you can retrieve.
Though not sure why you would want the overhead is the image being loaded from a different source than the server from which this content is being served?

If the remote site allows directory browsing, you can look at the image folder and use the proper name they have there.  It might have been switched to jpg. JPEG, png because of gif limitations, implications.
MCaliebeAuthor Commented:
What I'm doing is using a MS Access DB form to view properties of different items.  I don't have local copies of the images which correspond to the data I'm working with, so I set up a picture control on my form to get the picture from the web when I pull up the item.

Sometimes the weblink generated is correct, other times it is not.  It always appears to be a formatting issues- Upper and Lower case.  I was hoping to test the first link, if a picture is there, use it, if not, move onto the next possible formatted web link and use it.
Instead of attempting to retrieve, you can issue a Request for the header of the data you wish to retrieve, and you will need only to handle the response to determine if the file is there, 2xx response. 3xx means the location changed, which means you need to look at the location: from the response to determine where it moved to.
If you get 4xx or 5xx means there is an issue first file not there or is inaccessible, the other server ran into a situation and can not respond,......
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

MCaliebeAuthor Commented:
I've not played with much related to web request and responses.  Can you elaborate on how this might be done or direct me to where I might find examples?
Here is a link,
In the suggestion, you would use HEAD as the request not POST nor GET.
MCaliebeAuthor Commented:
Would this be correct?  It is moving through the code fine, however I never see any "Result"

Public Function WebHeadRequest(MyURL)

Dim result As String
Dim winHttpReq As Object
Set winHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")

winHttpReq.Open "HEAD", MyURL, False
result = winHttpReq.responseText
Debug.Print result

End Function
The head request never includes text, you need the getresponseheade.
And status.
The methods/option available in winhttp

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MCaliebeAuthor Commented:
That worked.  I was able to get a response like "200" or "403" and work with these responses.

winHttpReq.Open "GET", MyURL, False
result = winHttpReq.Status
WebHeadRequest = result
Use HEAD instead of Get.  You get the same status header response without the overhead of retrieving data unnecessarily.
MCaliebeAuthor Commented:
Got it!  Thanks!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.