Avatar of Anton Greffrath
Anton Greffrath
Flag for South Africa asked on

MS Acess 2013 for HTTP Get and Post

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. . . . .
Microsoft Access

Avatar of undefined
Last Comment
Gustav Brock

8/22/2022 - Mon
Gustav Brock

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 Sherman

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
Anton Greffrath

ASKER
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.
Your help has saved me hundreds of hours of internet surfing.
fblack61
Eric Sherman

<<<<<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
Gustav Brock

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
Anton Greffrath

ASKER
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
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Gustav Brock

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 Sherman

<<<<<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
Anton Greffrath

ASKER
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
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Anton Greffrath

ASKER
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.
Gustav Brock

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
ASKER CERTIFIED SOLUTION
Eric Sherman

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Anton Greffrath

ASKER
Quick Response and to the point. . .
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Anton Greffrath

ASKER
ET, I am new to this User Group, Am I involved in allocating points for this solution?
Gustav Brock

Thank you for - eh - nothing ...

/gustav