Results 1 to 8 of 8
  1. #1
    Join Date
    Oct 2003
    Location
    Hyderabad, A.P., India
    Posts
    29

    Unanswered: urgent: passing parameters from vb to access query

    hi all,

    I have a view (query) created in ms acess. how can i pass a parameter from vb to the query at runtime? can i do it?
    Thanks and regards
    mrc

  2. #2
    Join Date
    Jan 2004
    Location
    Boston, MA
    Posts
    11

    Re: urgent: passing parameters from vb to access query

    The only way I've seen to do this is by creating a table with the full range of parameter values that can be passed in and selecting those in a new view with the values from the main view without joining them. For example:

    create table ParamVals (ParamVal datetime)

    (then run a while loop or something to insert all the values into the table)

    create view ParamView

    select ParamVals.ParamVal, Col1, Col2, etc....
    from ParamVals, MainView


    That way, the view will have a row for each of the ParamVals so you can pass that in from VB as a WHERE condition, along with whatever other WHERE conditions you use from the main view. Hope this helps.
    Mike

    "Border relations between Canada and Mexico have never been better."
    -George W. Bush

  3. #3
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    SELECT * FROM query WHERE col1 = Parameter?
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  4. #4
    Join Date
    Jan 2004
    Location
    Boston, MA
    Posts
    11
    No, he's trying to do something else, which I've seen before. Spend some time actually thinking about the question before replying with an attitude.
    Mike

    "Border relations between Canada and Mexico have never been better."
    -George W. Bush

  5. #5
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    I thought there was a way in vb using ado to interface into access that would allow you to pass the parameters,.... it's been ages since I have done anything with access or vb so I have very little chance of remembering of finding exactly what it was.

    The solution posted above would work, not necessarily elegant, but if you are in a hurry it's probably your best solution.

    You could try posting this question in Access and VB forums, there might be more poeple who can help there.

  6. #6
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Originally posted by dbmike
    No, he's trying to do something else, which I've seen before. Spend some time actually thinking about the question before replying with an attitude.

    ?????????????????
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  7. #7
    Join Date
    Oct 2003
    Location
    Hyderabad, A.P., India
    Posts
    29

    Thumbs up

    hi dbmike,

    thanx very much for the reply. the solution worked well.

    regards
    ramesh
    Thanks and regards
    mrc

  8. #8
    Join Date
    Jan 2004
    Location
    Boston, MA
    Posts
    11
    No problem, glad it worked.
    Mike

    "Border relations between Canada and Mexico have never been better."
    -George W. Bush

Posting Permissions

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