Create Form Run Query Display in Form

Create Form Run Query Display in Form

Post by dGl0YW » Sat, 23 Jul 2005 00:36:12


Hi,
Im trying to create a form for searching. I want that form to be able to
once a button is clicked, run queries on selected fields and return all data
associated with those records in a Form View.

Please help

thanks
 
 
 

Create Form Run Query Display in Form

Post by John Vinso » Sat, 23 Jul 2005 14:50:30

On Thu, 21 Jul 2005 08:36:12 -0700, "titan"



Create a Query using the form's fields as criteria: e.g.

=[Forms]![formname]![controlname] OR [Forms]![formname]![controlname]
IS NULL

on the Criteria line for each field that you want to search.

Create a new Form based on this query displaying the data you want to
see.

Put a command button on the first form to open the second form (use
the command button wizard).

John W. Vinson[MVP]

 
 
 

Create Form Run Query Display in Form

Post by dGl0YW » Sat, 23 Jul 2005 22:20:04

Thank you,
Im still having a problem. here is what I did, if you could help.
I created a form based on a table that has data in it. I then created a
query based on that form with a command button. I then created a new form
based on that query. The command button is linked to open the second form.

the problem i had was when i opened up my first form, the data was already
in it. I could not add new data. I think i needed a blank form to type in
what i am searching for, but the data for the records were there, also it
wouldnt let me add new records, which is good becuase this is just for
searching, but I could not type in anything to search for.

Please help if you can.

thank you in advance

titan
 
 
 

Create Form Run Query Display in Form

Post by John Vinso » Sun, 24 Jul 2005 03:21:17

On Fri, 22 Jul 2005 06:20:04 -0700, "titan"



There's something else wrong with your first form, then. If it won't
let you add data, you can check the Form's AllowAdditions and
AllowEdits properties (they should both be True if you want to do so);
you also need to be sure that the form is based upon an updateable
Query or else directly on a Table.


John W. Vinson[MVP]
 
 
 

Create Form Run Query Display in Form

Post by dGl0YW » Sun, 24 Jul 2005 04:12:01

thank you for your help but im still having trouble.

i created a form based on a query. the query was based on a 2 different
tables. i think that because its a query, its not letting me add data. i
checked the form properties and they are all set to yes. im not sure why the
data of the first record comes up in the form, and then why i cant type in
data. maybe its to prevent me from entering data that would overwrite the
table data, which is a good thing. i need to be able to enter the data in a
clean form and then be able to search. this is for other people to use
constantly so form by filter wont work becuase they dont know how to use it.
Please help if you can and give me detailed instructions on how to set up the
form, table, query, ect... The search parameters that i entered into on the
query work when i hit the search button that i created. its just the form is
already filled with data before i search.

thank you for your patience

titan
 
 
 

Create Form Run Query Display in Form

Post by John Vinso » Sun, 24 Jul 2005 05:07:59

On Fri, 22 Jul 2005 12:12:01 -0700, "titan"



Some queries are updateable; some are not. Try opening the Query in
datasheet view - is there a "new record" line? If not, check the table
definitions: do you have a unique Index (such as a Primary Key) on the
field in the "one" side table that you're using for the join? That's
essential, and a common cause of this problem. If that's not it,
please open the Query in SQL view and post the SQL text here.


Then you MUST - NO OPTION - use an Unbound form. A Query is not a
separate reality from its table; editing the query edits the table,
the query is just a view of the table.


Use a different form, a Form with nothing in its Recordsource
property, to collect your criteria.

John W. Vinson[MVP]
 
 
 

Create Form Run Query Display in Form

Post by dGl0YW » Sun, 24 Jul 2005 05:36:03

It all worked out, i changed a few things and it worked, thanks for your help.

titan