Alpha Video Training
Results 1 to 4 of 4

Thread: How do I make a browse display a query?

  1. #1
    Brian Moses
    Guest

    Default How do I make a browse display a query?

    I have a browse hooked to a table and it displays the entire table ok. When the user hits a button on the form, a script runs that creates a query on the same table that the browse is hooked to. Once the query is created, how do I refresh the browse to display only the queried results? Here is the code i am using to test this:

    '=================================================
    t1 = table.open("schedule") 'open the "schedule" table.
    query.filter = "Bay = '4'" 'query from "Bay" field (char)
    query.order = "" 'order query by "Bay" field
    query.options = ""
    q1 = t1.query_create() 'create query
    parentform.resynch()
    browse2.refresh()
    browse2.resynch()
    '=================================================

    Is there some other property I can use for the browse to make it recognize the query? With the code I have above, the query is created and the browse refreshes ok, but it still displays ALL fields in the table.


    --Brian

  2. #2
    "Certified" Alphaholic Keith Hubert's Avatar
    Real Name
    Keith Hubert
    Join Date
    Jul 2000
    Location
    London, UK
    Posts
    6,930

    Default RE: How do I make a browse display a query?

    Brian

    This may help. The browsw is on a form that is made from a Set. When the date field fires OnChange the following script runs.

    this.resynch()

    tbl=table.current()
    tbl.index_primary_put("date1")
    tbl.fetch_first()
    browse1.index_set("date1")
    browse1.resynch()
    browse1.refresh()

    If you have a look at my ActiveX calendar in the Code Archive it should be a little clearer.

    Keith Hubert
    London.

  3. #3
    "Certified" Alphaholic forskare's Avatar
    Real Name
    Ken Nordin
    Join Date
    Apr 2000
    Location
    Walker, MN
    Posts
    7,545

    Default RE: How do I make a browse display a query?

    Brian,

    If you have an embedded browse on a form and both are based on the same table, there is no need to refresh the browse.

    You should not need:

    parentform.resynch()
    browse2.refresh()
    browse2.resynch()

    as the only records available are the results of the query. At least I haven't needed to use this code and I've never had a problem.

    kenn

  4. #4
    "Certified" Alphaholic
    Real Name
    Peter Wayne
    Join Date
    Apr 2000
    Posts
    1,728

    Default RE: How do I make a browse display a query?

    Brian,
    you start with
    t1 = table.open("schedule") 'open the "schedule" table.
    that opens a second pointer to schedule. the query will act on the second pointer, not on the one that has been opened by the form.
    you should just write

    t1=table.get("schedule")

    and then your code should execute properly and the browse on the form will reflect the selection made by the query.

Similar Threads

  1. make var on a form display a default value
    By Martin Lines in forum Alpha Five Version 6
    Replies: 4
    Last Post: 05-17-2005, 06:31 PM
  2. Form Display after a Query
    By Phil Rolf in forum Alpha Five Version 5
    Replies: 7
    Last Post: 08-16-2004, 11:16 AM
  3. Make Browse Highlight Row
    By Blake in forum Alpha Five Version 5
    Replies: 4
    Last Post: 01-21-2004, 05:13 PM
  4. How to make a search box/field in a form/browse
    By kim hansen in forum Alpha Five Version 5
    Replies: 15
    Last Post: 03-10-2003, 09:35 AM
  5. display a browse
    By vasant panjabi in forum Alpha Five Version 4
    Replies: 5
    Last Post: 03-24-2001, 01:44 AM

Bookmarks

Posting Permissions

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