Results 1 to 4 of 4

Thread: Text Fields on Form to Parameters in Query

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2008
    Location
    Salt Lake City, UT
    Posts
    2

    Text Fields on Form to Parameters in Query

    Hello,

    I'm just learning (slowly), and am having trouble with the following.

    I've got a query in MS Access (2003) with parameters of "city", "startDate" and "endDate". These are fixed so when you open the query, the parameter windows pop up for you to fill in.

    I am trying to create a form where a user can fill in the above information, click the button and have the user defined text fields take the place of those parameter windows above. (Or have them collect the info from the form and not pop up.)

    Also, I would like for a field of the query result to show in a separate text box on the form once complete. (This would be a percentage that I would need a format change from the query result.)

    Thanks in advance for your assistance!
    Last edited by K8Shrew; Dec 9th, 2008 at 04:24 PM.

  2. #2
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Text Fields on Form to Parameters in Query

    Welcome to the forums!

    You will need to use a Command object. Have a look at this, included is using a query to add a record, you can modify it to suit your need.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2008
    Location
    Salt Lake City, UT
    Posts
    2

    Re: Text Fields on Form to Parameters in Query

    Thanks for the reply!

    I actually was able to fix it with some simple steps! To fill in the parameter prompts, I did the following:

    DoCmd.OpenQuery "qryNPSbyCity"

    [City] = Me.City
    [StartDate] = Me.StartDate
    [EndDate] = Me.EndDate


    and to fill in the value from the query to the form, I used:

    Me.NPS.Value = DLookup("NPS", "qryNPSbyCity")

    Then I added:

    DoCmd.Close acQuery, "qryNPSbyCity"

    to remove the open query from the screen.

    Pretty exciting!

  4. #4
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Text Fields on Form to Parameters in Query

    If your problem has been solved then you can now mark your thread as resolved using the Thread Tools menu.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width