Results 1 to 3 of 3
  1. #1
    JackRush is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jun 2011
    Posts
    1

    Creating a Dynamic Query

    Firstly I know very little about microsoft access. I know how to create basic queries.


    I need to create two queries
    One with a criteria which needs to be entered everytime accessed. E.g. Date is variable according what you need to find.
    I want to make it so that the user can type in a date that they wish to look for and it will be displayed with all the relationships.

    Two
    A A query which does calculations similar to excel. Uses data from the first query such as the date entered and calculates new data from it.
    E.g. A addition of all results if they were a number in a row.

  2. #2
    Rod is offline Expert
    Windows Vista Access 2007
    Join Date
    Jun 2011
    Location
    Metro Manila, Philippines
    Posts
    679
    The simple solution is to define a selection criterion for the corresponding date attribute in the query design grid. For example:

    Attachment 3654

    results in Access soliciting a date each time the query is run. Remember to enclose the prompt in brackets.

    Attachment 3655

    Beware though of different formats. You may want to indicate a format in the prompt such as (#mm/dd/yy#).

    More a more sophisticated and flexible solution you need to define parameters at the time of specifying the query

  3. #3
    Rod is offline Expert
    Windows Vista Access 2007
    Join Date
    Jun 2011
    Location
    Metro Manila, Philippines
    Posts
    679
    Question 2.

    There's no real difference here. For example:

    Attachment 3656

    Here's the generated SQL:

    SELECT tblTest.*, [MyEnteredDate]+4 AS MyCalcDate
    FROM tblTest;

Please reply to this thread with any new information or opinions.

Similar Threads

  1. open a report using VBA from dynamic query?
    By haggisns in forum Programming
    Replies: 3
    Last Post: 10-15-2010, 08:45 AM
  2. Replies: 1
    Last Post: 07-30-2010, 10:28 AM
  3. Dynamic criteria Query
    By ser01 in forum Queries
    Replies: 7
    Last Post: 02-22-2010, 11:41 AM
  4. Dynamic Query
    By pushpm in forum Queries
    Replies: 0
    Last Post: 04-22-2009, 12:58 PM
  5. Dynamic SQL Query
    By Squeaner in forum Queries
    Replies: 0
    Last Post: 09-25-2008, 02:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums