Displaying query results in a form

A

Andy Wall

I'm developing a database to store and analyse contract information. I've
normalised all the tables and created the relational db and am in the process
of creating the screens and links etc for the process flow. As part of the
flow for creating a new contract I need to enable the user to search for a
client relationship ID to link to the new contract, i.e. The user is
displayed form Create Contract, with field RelationshipID, if it is know they
can simply enter the unique ID, if not I have added a "Search for Client"
button as well as a "Create Client" button. Create Client is self
explanatory and works, "Search for Client" I wish to create a parameter query
for the user to enter the Contact Name and the query to return all data from
the Client table to a sub or prefereably another form. So far the query
works and is built but the only options I have for display are datasheet,
print preview etc (using Access 2007) which doesn't look very good as part of
a professional system. How can I code this so that, when the user selects
the Search button they are prompted for parameter entry but the results are
returned within a form for them to view? Thanks in advance for any advice.
 
M

Michel Walsh

You can use a list box. Supply the row source with the string of the SQL
statement:


Me.ListBoxName.RowSource = "SELECT ... "



Be sure to have the right number of columns (column count) in the list box
control. It should match the number of columns from your SELECT statement.

You can also use a datagrid (from VB6), but then you have to supply the
control and all what may come as problem, in the distribution pack.




Vanderghast, Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top