MS Acess 2013 for HTTP Get and Post

Anton Greffrath
Anton Greffrath used Ask the Experts™
on
I am busy with development that link my MS Access 2013 database to GET data from the SQL Server as well as POST data to the SQL Server.
I am aware of the 'HTTP Get' and 'HTTP Post' functions and would like to know where I can get reading material on these two functions that explains all the parameters for MS Access specifically. Also some logical diagrams that show data flow.
Any help is appreciated. . . . .
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
SQL Server is not a web server.

In Access, go to External Data and select ODBC database. Set up a connection to the server and link/attach the tables/views you need. Lots of tutorials on this for the browsing.

/gustav
Eric ShermanAccountant/Developer

Commented:
I use Pass-Through Queries with Access and SQL Server.  You can Link the tables as gustav posted or you can include the Connection String in the query Property "ODBC Connect Str"  as shown below...

ODBC;Driver={SQL Server};Server=xxx.xx.xxx.x;Database=YourDBName;User=YourUserName;Password=YourPassword;

Open in new window


Then, just run your queries in your Access front-end.

ET

Author

Commented:
Thanks Gustav and Etsherman. . . . . . .

Apologies, I did not give you the full picture. The SQL Server export the data do a folder and I need to 'Get' the data from this position, external to the SLQ Database.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Eric ShermanAccountant/Developer

Commented:
<<<<<Apologies, I did not give you the full picture. The SQL Server export the data do a folder and I need to 'Get' the data from this position, external to the SLQ Database. >>>>>

What format is the data in that you want to import into Access???

ET
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
And how can get to that file? Is it on a file server you have access to, or is it hosted by a web or ftp server?

/gustav

Author

Commented:
Gustav

The file is in CSV format as supplied  from the SQL Database. I have access to the file location via:
http://cosmo.co.au/CSV/GetClients, where GetClients is the CSV File
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
Then the simple method is to download the file to a folder your application has access to and import it from there.

To retrieve the file, use a function like this:
Option Compare Database
Option Explicit

Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" ( _
    ByVal pCaller As Long, _
    ByVal szURL As String, _
    ByVal szFileName As String, _
    ByVal dwReserved As Long, _
    ByVal lpfnCB As Long) _
    As Long


Public Function DownloadFile( _
    ByVal strURL As String, _
    ByVal strLocalFilename As String) _
    As Long
  
' Download file or page with public access from the web.
' 2004-12-17. Cactus Data ApS, CPH.

' Usage, download a file:
' lngRet = DownloadFile("http://www.databaseadvisors.com/Graphics/conf2002/2002ConferencePicsbySmolin/images/dba02smolin27.jpg", "c:\happybassett.jpg")
'
' Usage, download a page:
' lngRet = DownloadFile("http://www.databaseadvisors.com/conf2002/conf200202.asp", "c:\dbaconference.htm")

' Returns 0 if success, error code if not.
' Error codes:
' -2146697210 "file not found".
' -2146697211 "domain not found".

' Limitation.
' Does not check if local file was created successfully.

    Dim lngRetVal As Long
      
    lngRetVal = URLDownloadToFile(0, strURL & vbNullChar, strLocalFilename & vbNullChar, 0, 0)
    
    DownloadFile = lngRetVal
  
End Function

Open in new window

/gustav
Eric ShermanAccountant/Developer

Commented:
<<<<<The file is in CSV format as supplied  from the SQL Database.>>>>>

Download the file ... Then use the Import Wizard in Access to import a Text file as shown below.  You can click the Advanced button and create an Import Spec for your file.

ET

Import Text

Author

Commented:
Thanks Gustav and Etsherman, great answer and quick response! I have implemented your suggestions and it works like a dream.

I still require some reading material on the subject, do you perhaps have a link to such material? it was nice implementing the solution but I would like to have an understanding of the subject. . . .

Many thanks again

PetranAnton

Author

Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for PetranAnton's comment #a41164284

for the following reason:

I could implement the code, with minor changes to fit my environment, and it worked the first time.
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
Great. Then mark the solutions as answers.

You can bing/google on the API call URLDownloadToFile.

For the file import, use the help from Access itself.

/gustav
Accountant/Developer
Commented:
I am confused ... Why no points awarded for the various solutions provided???

ET

Author

Commented:
Quick Response and to the point. . .

Author

Commented:
ET, I am new to this User Group, Am I involved in allocating points for this solution?
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
Thank you for - eh - nothing ...

/gustav

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial