Results 1 to 5 of 5

Thread: Condition Macro

  1. #1
    Join Date
    Apr 2004
    Location
    Dubai
    Posts
    5

    Unanswered: Condition Macro

    Hi, I need help with Access. Could you please help me with creation Search Form. Im trying to create search Form, I want when the I enter the number in the field then click on search, other form open with the result which read from query. I think there should be link between the search form and result form, which read from query (condition macro). I need explanation with creation these form and what should be the link and who to create condition macro for this issue.

    Thanks.
    Faris_dxb

  2. #2
    Join Date
    Mar 2004
    Location
    UK
    Posts
    82

    Re: Condition Macro

    This should work for you.

    Create a query containing all of the data that you want to search.

    under the event properties of your click button (search) assign a macro.
    (good tip, call your macro something like "searchqueryfromform".
    give it a name that discribes what it does.

    then create a form to view your query. call it "Viewsearchedrecordform" or somthing.
    (i learnt from experience with a db that has about 50 forms and 100 macros)

    set your macro to carry out the following actions

    OPENQUERY (under the where condition in the query or on the macro line enter forms!<name of form>!<nameoffieldor text box containing value!

    OPENFORM(open the form based on the query)

    hey presto.

    you might want to add another line to the macro to set it to close the search form.

    hope this helps

  3. #3
    Join Date
    Feb 2004
    Location
    Wales
    Posts
    343
    hi
    There could be an easier way of dealing with a search screen

    create a form in design mode
    Place a text box on the form - name it SEARCH (or what ever you want to name it)

    Save the form using correct naming routines something like frm_SEARCH_ORDERNUMBER

    Create a query with ALL the fields you will want to see when you find your information.

    In the crieria section below the field that you want to find enter

    Like [Forms]![frm_ Search_Ordernumber]![search]

    This will look for a number you entered on the seach form
    save the query with a name that means something relevant to what you want the query doing ie qry_Search_Ordernumber

    Create another form using the wizard which is set against the new query name that form something like frm_ordernumber_screen

    return to the 1st from (frm_SEARCH_ORDERNUMBER) and place a command button on it via the wizard and set it to open the last form you made (frm_ordernumber_screen)

    When you now enter a number in the ist form and click the command button it should open the frm_ordernumber_screen with the details you want to see

    hope this helps

    gareth

  4. #4
    Join Date
    Apr 2004
    Location
    Dubai
    Posts
    5

    Cool

    Thanks for replay.

  5. #5
    Join Date
    Apr 2004
    Location
    Dubai
    Posts
    5

    Thumbs up

    Thanks Gareth and Plate, it works.

Posting Permissions

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