Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Seminars   Templates   TechHelp   Fast Tips   Forums   Help   Contact   Join   Order   Logon  
 
Home > Courses > Access > Developer > D32 > D32 Lessons < D31 Lessons | D33 Lessons >
 
Access Developer 32 Lessons


Back to Access Developer 32 Lessons
 

Post Data which one is better Upload Images   Link  
Mubeezi Micah 
7 months ago
Hi Rick,

My question is on lesson 6 where you show the alternatives to the webbrowser control. I find it cool. I would like you;
1. To demonstrate how to use the post method using any of these two ways shown in the lesson.
Set XMLHTTP = CreateObject("MSXML2.ServerXMLHTTP")
'Set XMLHTTP = CreateObject("MSXML2.XMLHTTP")

2. I came across another way to go to a web page using VBA without the web browser control. I paste it below;
Public Function HTTPPost(URL As String, Msg As String)  'send HTTP POST to a server:
    With CreateObject("WinHttp.WinHttpRequest.5.1")
        On Error Resume Next        'ensures code contiunes to run without internet
        .Open "GET", URL, True      'True is asynchronous so UI does not hang
        .setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
        .setRequestHeader "Content-type", "application/x-www-form-urlencoded"
        '.SetRequestHeader "secret-pass-key", "your-key"    <--if needed
        .send Msg                   'throws an error when there is no internet
        .WaitForResponse            'pauses execution, but does not hang UI
                
        HTTPPost = .responseText
        
    End With
End Function

Now i am in a dilemma. Which of the three options should i use? Which one is future proof? Which one is better?

Thank you!

MICAH
Richard Rost
7 months ago
XMLHTTP and WinHttpRequest are very similar. That's really just a matter of preference. I've been using XMLHTTP for years with no issues. Both are definitely superior to the webbrowser control - unless your goal is to display something in a web browser for the user.
Richard Rost
7 months ago
And yes, I'll be covering POST soon. Usually you only use that with form field submissions.
Mubeezi Micah
7 months ago
Thank you Rick for clarifying

This thread is now closed. If you wish to comment, start a NEW discussion, below.
 


Back to Access Developer 32 Lessons
 

Start a NEW Conversation
 
Only students may post right now. Click here for more information on how you can set up an account. If you are a student, please LOG ON first.
 
Subscribe
 

You may want to read these articles from the 599CD News:

5/16/2022Referential Integrity
5/15/2022Invoicing Member Discussion
5/13/2022Multivalued
5/12/2022Number Field Size
5/11/2022Create Word Document
5/11/2022Export to Word
5/10/2022On Click Event Timing
5/9/2022Invalid Use of Null
5/7/2022Event Handler
5/6/2022Database Title & Icon
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Email Richard
Mailing Address
Phone Number
Fax Number
Course Survey
Blog RSS Feed    Twitter

YouTube Channel    LinkedIn