Results 1 to 3 of 3

Thread: [RESOLVED] Pass Parameter to Query from Access Form

  1. #1

    Thread Starter
    Fanatic Member Strider's Avatar
    Join Date
    Sep 2004
    Location
    Dublin, Ireland
    Posts
    612

    Resolved [RESOLVED] Pass Parameter to Query from Access Form

    Hi there,
    i have a simple select query in which i need to pass in a value from a textfield on an access form. the query will populate a combobox.

    how can i pass in a parameter to the query using the row source option in the designer
    Barry


    Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
    .NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0

    SQL Server 2005/2000/SQL Server CE 2.0


    If you like, rate this post

    Compact Framework for Beginners

  2. #2
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950

    Re: Pass Parameter to Query from Access Form

    Not sure what you mean.
    You could write your query in code:
    "SELECT * FROM Foo WHERE foobar = '" & text1.text & "'"
    or if it's an existing query, you could use the Parameters collection of, I think, the QueryDef object. Something like that, anyway, don't use it myself.
    Tengo mas preguntas que contestas

  3. #3

    Thread Starter
    Fanatic Member Strider's Avatar
    Join Date
    Sep 2004
    Location
    Dublin, Ireland
    Posts
    612

    Re: Pass Parameter to Query from Access Form

    SELECT tbl_Category.Category
    FROM tbl_Category
    WHERE (((tbl_Category.Location)=Forms!Maintenance!cmboNewLocation));

    add the control item you want the value from in the sql view of the query designer
    Barry


    Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
    .NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0

    SQL Server 2005/2000/SQL Server CE 2.0


    If you like, rate this post

    Compact Framework for Beginners

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