简体   繁体   中英

how to send data to website database using vba

I'm having trouble on how to word this in to a google search and couldn't find many results with what I tried.

I am re-writing a VBA program (using MS Access) for our company. We run queries and reports for multiple external sources. I am required to send this to a third party who is helping us. What I would like to do is know when it is being used so I want to implement a procedure that submits usage information to our company website.

I have look at doing via MySQL and directly writing to the website backend database but not everyone will have the MySQL driver installed, plus with our hosting company, it requires we know the IP address of the computer sending the information for it to get past the firewall. My only other idea is for it to submit the information to a web form and post it. I have controlled websites before using VBA but I want it to be quiet and unobtrusive.

It's not something that has to work every time. It's more so we know if the application gets distributed outside of who we give it to.

Any ideas??

Thank you.

Here's how to do it in VBA for Excel , I assume it'll be similar in Access..

Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")

URL = "http://www.somedomain.com"
objHTTP.Open "POST", URL, False
objHTTP.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
objHTTP.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
objHTTP.send ("var1=value1&var2=value2&var3=value3")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM