Source Object as a query

Hi i have a form that contains 2 text box's and a subform what i really want to do is to run a query and not have an input box popup i would like the dates entered into the 2 text box's to be used in the query of the subform and display a table that shows all records that are between date 1 and date 2.

SQL code:
PARAMETERS [First] Text ( 255 ), [Second] Text ( 255 );
SELECT Equipment.*
FROM Equipment
WHERE (((Equipment.[Date Installed])>[First] Or (Equipment.[Date Installed])<[Second]));

i want to beable to call this query from a form or to write this query using the values in the text boxs to generate what records should be displayed.

not sure if its posible or if i made any sense can any 1 help


Answer this question

Source Object as a query

  • Donald Henderson

    Ok i did some research into Stored procedures i think i'm noty totally understanding them how would i create 1 in Access VBA.

    I think using a sub form that can navigate the records would be doable as i already use this approach but using a dynamic query based on user input has me completly puzzled i suspect i just need to work more on it.

    Thanks for the help any more advice would be much appreciated.

  • frankc83

    Per our support engineer:

    In fact in Access, we haven’t provided store procedure. We have modules in access, we can write query scripts in modules as some function. Then invoke these functions from our code. Just like invoke functionsJ You can read the access help file about the modules.
    < xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
    -brenda (ISV Buddy Team)



  • jijo123

    Here's a suggestion from one of our support engineers:

    He can generate the sql query in his code, get the value input by the user maybe the code like “Equipment.[Date Installed] > “ + textbox.text. Then use the generated sql to do query. He can also use store procedure, then invoke in code, maybe the code like exec storeprocdure textbox.text.
    < xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

    I hope this helps,
    -brenda (ISV Buddy Team)



  • Pascal Bourque

    In Access I'm not totally sure on how to use stored procedures however if its part of say VBA would i create a global procedure and pass to it the values stored in a both text boxes.

    that parts not to tough if i'm understanding your reply correctly the hard part is outputing to a subform would the subform use the source object referrencing the procedure or is there another way to display all records that are retreived.

    I'm Very new to access only used SQL server 2000 and C/C++ languages been a student on placement means learning new things so i could have totally misread your reply.

    I'd also like to say thanks for the help great to know there is a place to go for help if needed.

  • Source Object as a query