Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    Join Date
    Jun 2004
    Location
    Seattle, WA
    Posts
    601

    Unanswered: Query Asking for PKey on Run

    I have a query that joins two tables, when I run the query, it runs fine. When I add a parameter, it asks for the parameter, then my primary key. I am unsure why this happens. While I know what the PK value is, but my user wont. Any work arounds?
    Ryan
    My Blog

  2. #2
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Is your PK an autonumber field? Can you supply more details? If the query doesn't recognize a field from the table in the query (ie. you've mistyped the fieldname in the query), you'll get a parameter prompt (unless you ask to prompt for criteria in an expression for that field). You don't need to supply values for autonumber fields.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  3. #3
    Join Date
    Jun 2004
    Location
    Seattle, WA
    Posts
    601
    My PK is an auto number. The parameter is a date field, I am looking for a single date not a range. I thought I mistyped, I started from scratch and did all the selection by drag and drop. And I just did [blah blah] in the criteria field for the date. So there is no typos.
    Ryan
    My Blog

  4. #4
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    If you remove any criteria from the criteria row in the query, do you still get a parameter popup message?
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  5. #5
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    This also might be a little easier to diagnose if I saw it. Any chance you could zip a quick copy of it and upload it? Sometimes a 2nd eye is all it takes.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  6. #6
    Join Date
    Jun 2004
    Location
    Seattle, WA
    Posts
    601
    No I don't
    Ryan
    My Blog

  7. #7
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    So is the criteria the issue then or is the problem solved?
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  8. #8
    Join Date
    Jun 2004
    Location
    Seattle, WA
    Posts
    601
    The criteria is the issue, because the user will need to search.
    Ryan
    My Blog

  9. #9
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Okay......and the criteria is.....or have you fixed the issue? Not sure if it's relevant but if I put 2 autonumber fields in a query, I sometimes make one of them an expression (ie..XX: int([tablename].[PKField]).)
    Last edited by pkstormy; 07-24-07 at 17:31.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  10. #10
    Join Date
    Jun 2004
    Location
    Seattle, WA
    Posts
    601
    There is no set criteria, all I have in the criteria field is [Enter a date].
    Ryan
    My Blog

  11. #11
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    And this is on a date field and you're entering a legitimate date value for the prompt.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  12. #12
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    And there are no bad date values in that field in the table (ie. 03/07 instead of 03/13/07).
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  13. #13
    Join Date
    Jun 2004
    Location
    Seattle, WA
    Posts
    601
    Correct, all are mm/dd/yyyy
    Ryan
    My Blog

  14. #14
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Ryan,

    Help me understand the issue here. You said in your first post that you get a 2nd prompt for the primary key.
    "When I add a parameter, it asks for the parameter, then my primary key."
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  15. #15
    Join Date
    Jun 2004
    Location
    Seattle, WA
    Posts
    601
    Correct Paul.

    I have a join query. If I just run it, it works fine, I get my results. If I put something in the criteria line, I get the pop up with access asking for my parameter, then I select ok, then I get a pop up for my key.

    --
    I just compacted it a few times and the remaking the query, the pkey things goes away. I then manually made the query in the form builder wizard. After going in and fixing the query to take a parameter, the pkey request came back
    Ryan
    My Blog

Posting Permissions

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