Database search form - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Database search form

double-pdouble-p Posts: 1Member
What is the best way to use a search form with an Access database. Currently, i have each search option with a radio button. I planned on using something like 'if radName.checked=true' then perform a SQL statement, and so on for the rest of the radio buttons. However, I do not know exactly to do this. Should I send the results to a datagrid on a new form? How do I pass each sql statement on to the datagrid?

any help would be appreciated. thanks.

Comments

  • GogiGogi Posts: 258Member
    Hi,

    I think you should use DataView component.
    Just set it's Sort,RowFilter and Table properties.
    Using RowFilter is almost same as using an SQL statement.

    [code]
    'Set the table to the dataview:
    DataView1.Table=DataSet1.Tables("NameOfTheTable")

    'Column to sort by:
    DataView1.Sort="NameOfTheColumn"

    'Put your SQL statement here:
    DataView1.RowFiter="NameOfTheColumn Like 'A%'"

    'Display the returned records in a table:
    DataGrid1.DataSource=DataView

    [/code]

    This code should display all the records which start with "A" in the DataGrid control.


    Hope this helps!

    Gogi.

    : What is the best way to use a search form with an Access database. Currently, i have each search option with a radio button. I planned on using something like 'if radName.checked=true' then perform a SQL statement, and so on for the rest of the radio buttons. However, I do not know exactly to do this. Should I send the results to a datagrid on a new form? How do I pass each sql statement on to the datagrid?
    :
    : any help would be appreciated. thanks.
    :

Sign In or Register to comment.