Results 1 to 6 of 6
  1. #1
    ryantam626 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    10

    Problem about parameters in query

    Code:
    PARAMETERS [forms]![queryform]![end date] DateTime, [forms]![queryform]![start date] DateTime, [forms]![queryform]![work type] Text ( 255 ), [forms]![queryform]![project id] Text ( 255 ), [forms]![queryform]![work designation] Text ( 255 ), [Forms]![QueryForm]![Machine Designation] Text ( 255 );SELECT [Progess Table].[Date Of Work], [Progess Table].[Work Designation], [Machine Work-Progress Table].[Machine Designation], [Progess Table].[Work Type], [Progess Table].[Project ID], Sum([Progess Table].[End increment]-[start increment]) AS [Increment Difference]
    FROM [Machine List] INNER JOIN ([Progess Table] INNER JOIN [Machine Work-Progress Table] ON [Progess Table].[Progess ID] = [Machine Work-Progress Table].[Progess ID]) ON [Machine List].[Machine Designation] = [Machine Work-Progress Table].[Machine Designation]
    WHERE ((([Progess Table].[Date Of Work]) Between [Forms]![QueryForm]![Start Date] And [Forms]![QueryForm]![End Date]) AND (([Machine List].[Production Machine])=True) AND (([Machine Work-Progress Table]![Machine Designation]=[Forms]![QueryForm]![Machine Designation] Or [Forms]![QueryForm]![Machine Designation] Is Null)=True));
    Now I am using
    Code:
    [Machine Work-Progress Table]![Machine Designation]=[Forms]![QueryForm]![Machine Designation] Or [Forms]![QueryForm]![Machine Designation] Is Null
    in a field to use a combobox as a criteria and return all records if combobox is blank. The problem is when I define the parameters, it wont return anything if I dont select something in the combobox, how can I make it work? (I need to define the parameters because it will be changed to a crosstab query.)

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,598
    I have never use PARAMETERS.

    Here is one technique for filtering a form http://datapigtechnologies.com/flash...tomfilter.html.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,847

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,598
    I have seen PARAMETERS clause before. Review http://msdn.microsoft.com/en-us/libr...ffice.12).aspx

    I just don't understand it much, not seeing benefit in its use.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,847
    It is much like using [Enter Name] or whatever in a query.
    It prompts for each defined Parameter.
    However, if you have to use a parameter value more than once, you only have to enter the value once.

    Don't know that there are many benefits, but you can set up some "templates" for users, and declare data type and ensure the SQL is sound, b efore handing it to user.


    Here's more from Martin Green's site
    http://www.fontstuff.com/access/acctut01.htm

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,598
    My experience with Access query popup input prompts is if the same criteria parameter is identical under multiple fields, prompt will popup only once and the input will apply to all. So still not seeing benefit to PARAMETER clause, except maybe being able to restrict the input type. However, I never use popup input prompts.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 14
    Last Post: 03-07-2012, 03:46 AM
  2. query help with parameters
    By Madmax in forum Access
    Replies: 2
    Last Post: 03-05-2012, 03:07 PM
  3. Msgbox in a query with parameters
    By seb in forum Forms
    Replies: 7
    Last Post: 07-06-2010, 05:07 AM
  4. Replies: 3
    Last Post: 07-01-2010, 07:55 PM
  5. Add query parameters in with vbCode?
    By ~SwAmPdOnKeY~ in forum Programming
    Replies: 0
    Last Post: 08-07-2008, 07:58 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