Solved

Post data from form fields to URL as variables within MS Access

Posted on 2011-03-17
12
323 Views
Last Modified: 2013-11-27
I have a need to create a form within Access, with a button that will send the current values of the form as values within an xml request to a URL.  The remote server will return something, and I will need to have the ability to log or display that information.  

Ive never done anything like this within Access; is it possible?   Ive got all the forms/tables made, I can provide them if needed.  
0
Comment
Question by:lorsungcu
  • 6
  • 5
12 Comments
 
LVL 21
ID: 35157708
Yes it is possible to do with Access. What version of Access are you using?
0
 
LVL 2

Author Comment

by:lorsungcu
ID: 35157717
2010
0
 
LVL 17

Expert Comment

by:JezWalters
ID: 35157776
I'm not quite sure what you're trying to do, but you can perform HTTP POST requests from code in an Access form by adding a reference to the Microsoft WinHTTP Services library (via the WinHttpRequest object).
0
 
LVL 2

Author Comment

by:lorsungcu
ID: 35162946
Thanks, I got it working using objSvrHTTP, and POSTing XML as a string.  What I need now is to pull information from fields within a form, so when a user clicks a button, the values currently displayed are sent as values within the XML.  
0
 
LVL 17

Expert Comment

by:JezWalters
ID: 35164024
Do you mean that you just want help with the string manipulation, to build the XML?
0
 
LVL 2

Author Comment

by:lorsungcu
ID: 35165752
Essentially, yeah.  Am I able to define a variable as the result of a query?  I must, I'm just not clear on how.  I have a form where a user chooses their username, enters a password, and submits; it just checks that that all matches and send them to a second screen.  I need to use that username/password to query for two other values that I then need to insert into the XML.
My thought was to make a table that stores what user is currently logged in, as well as the values I need, and pull from there?  So when they click log in, create a new unique record of the login in this table, and use a look up to get the values I need?  Or is there a better way?

Thanks for the help!  
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 17

Accepted Solution

by:
JezWalters earned 500 total points
ID: 35167243
The result of a SELECT query is a recordset - although this could contain one record, many records or no records.  The attached sample database should show you how to loop through the records to build up your XML.

Open the form "frmYourForm" and enter User Name = "Fred", Password = "Password1" and then click the Build XML button. Is that the kind of thing you're after?
Q26893917.mdb
0
 
LVL 2

Author Comment

by:lorsungcu
ID: 35167317
Exactly what I need, but I am going about it a bit differently...I will give this a shot and see if I can apply it.

Thanks!
0
 
LVL 17

Expert Comment

by:JezWalters
ID: 35174928
How were you "going about it a bit differently"?

You could use DLookup() instead, but you'd need 2 calls in order to obtain the 2 values to insert into your XML - which is why the record set approach is better!  :-)
0
 
LVL 17

Expert Comment

by:JezWalters
ID: 35192325
How are you getting on with this question?  Do you need any more help or advice?
0
 
LVL 2

Author Closing Comment

by:lorsungcu
ID: 35199175
Thanks, works great.
0
 
LVL 17

Expert Comment

by:JezWalters
ID: 35199977
Glad I could help!  :-)
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now