Query Parameters in Access 2013 web apps (1 Viewer)

JaneJohnstone

Registered User.
Local time
Today, 10:00
Joined
Jan 2, 2014
Messages
20
Hi,
I'm creating my first web app with Access 2013 and I'd like to allow users to run a query after supplying a parameter to be used in the query.Simple example might be to display a list of all records that contain a date older than "x" in a particular field - with the user supplying the value for "x" I understand that query parameters don't work with the web browser and that I need to use a macro to request the input of "x" and pass it to the query, but I can't find any examples of this kind or macro action (OpenDialog, I understand from Jeff's book).
Has anyone done anything similar or have any advice to offer?
Many thanks
Jane
 

AccessJunkie

Senior Managing Editor
Local time
Today, 02:00
Joined
May 11, 2006
Messages
278
Hi Jane,

In order to fulfill your scenario of allowing the user to provide a value on a view in the web browser and then see records confined to that criteria, you need to do the following (in general terms here):

- Create a parameterized query that includes the fields you want. You must also define the parameter data types using the Query Parameters dialog box and then use them within the Criteria line for one or more of the query output columns.
- Create a view that uses that parameterized query as its data source.
- Create a different view that will be used to gather the needed query parameter(s) from the user and then open that other view using the OpenPopup macro action. That action will allow you to pass in the parameter(s) needed for the query and display the appropriate records in the popup view.

Does that help?

If you need a walk-through see the following sections in my 2013 book:
"Using Query Parameters" section of Chapter 5 in pages 325 through 330.
That shows you how to create this type of query.

The discussion with the same example continues in Chapter 8:
"Passing parameters to views" in pages 588 through 591.
That section shows you how to use the OpenPopup macro action to pass in the parameters.

Let me know if you're still stuck after reviewing that material.

Thanks,

--------------------
Jeff Conrad - Access Junkie - MVP Alumnus
Senior SDET - Access Test Team - Microsoft Corporation

Author - Microsoft Access 2013 Inside Out
Author - Microsoft Access 2010 Inside Out
Co-author - Microsoft Office Access 2007 Inside Out
Access 2007/2010/2013 Info: http://www.AccessJunkie.com

----------
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.mspx
----------
 

JaneJohnstone

Registered User.
Local time
Today, 10:00
Joined
Jan 2, 2014
Messages
20
Jeff,
Many thanks for this. (I didn't direct the question specifically to you as I didn't want to assume that you would be the one answering all questions posted here, but I'm delighted you've picked it up...)
As ever, I've been sidetracked on other things but hope to turn my attention to this today. I'll let you know hot it goes.
By the way - one thing I was sidetracked on was a request from a user to put together a simple application to allow them to record contacts with prospective clients. With the knowledge I had already built up, I could do this in minutes ( and I guess this is the real beauty of these access web apps - that someone like me with very little experience, from a standing start can build a useful application very quickly - thanks for helping me get to that stage.)
Jane
 

GingGangGoo

Registered User.
Local time
Today, 02:00
Joined
Dec 14, 2010
Messages
121
Hi Jane,

In order to fulfill your scenario of allowing the user to provide a value on a view in the web browser and then see records confined to that criteria, you need to do the following (in general terms here):

- Create a parameterized query that includes the fields you want. You must also define the parameter data types using the Query Parameters dialog box and then use them within the Criteria line for one or more of the query output columns.
- Create a view that uses that parameterized query as its data source.
- Create a different view that will be used to gather the needed query parameter(s) from the user and then open that other view using the OpenPopup macro action. That action will allow you to pass in the parameter(s) needed for the query and display the appropriate records in the popup view.

Does that help?

If you need a walk-through see the following sections in my 2013 book:
"Using Query Parameters" section of Chapter 5 in pages 325 through 330.
That shows you how to create this type of query.

The discussion with the same example continues in Chapter 8:
"Passing parameters to views" in pages 588 through 591.
That section shows you how to use the OpenPopup macro action to pass in the parameters.

Let me know if you're still stuck after reviewing that material.

Thanks,

--------------------
Jeff Conrad - Access Junkie - MVP Alumnus
Senior SDET - Access Test Team - Microsoft Corporation

Author - Microsoft Access 2013 Inside Out
Author - Microsoft Access 2010 Inside Out
Co-author - Microsoft Office Access 2007 Inside Out
Access 2007/2010/2013 Info: http://www.AccessJunkie.com

----------
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.mspx
----------

I realize this is an old thread, but your excellent resource helped me solve this exact issue. Now I have another question. My popup view shows all members in a specific location. Is is possible to set this up so that when I click in the popup on a specific member, the main form with all that person's information opens?
Thanks
 

Users who are viewing this thread

Top Bottom