Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Data Not Seen By Query

Status
Not open for further replies.

JHHPavel

Technical User
Jul 18, 2003
29
0
0
US
I'm writing a database with a simple form with 12 fields. Some are text and some are numeric. I have a select query which pulls the data from the form and just shows the value of each field. When I write it, it works fine. I save the query, close it and re-run and it works fine. If I shut down the database and re-open, the query no longer sees the form and I get a parameter query box for each field in the query.


Why does the query go bad on shutdown? It seems like it's haunted.
 
How are ya JHHPavel . . .

Confusing ... you say:
JHHPavel said:
[blue] I have a select query which [purple]pulls the data from the form[/purple] and just shows the value of each field.[/blue]
Queries normally derive data from tables. You can derive data from a form using custom fields like ...
Code:
[blue][Forms]![FormName]![ControlName] as FieldName[/blue]
... however it doesn't make much sense to do so for twelve fields. Also the form has to be open before you run the query/SQL.

Post the SQL of the query ...

[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
SELECT Formulas.[Formula Name], Formulas.[Kcal Per Unit], [Forms]![fInputForm]![Text2] AS Expr_T2, [Forms]![fInputForm]![Text4] AS Expr_T4, [Forms]![fInputForm]![Combo7] AS Expr_C7, [Forms]![fInputForm]![Option34] AS Expr_O34, [Forms]![fInputForm]![Text14] AS Expr_T14, [Forms]![fInputForm]![Text22] AS Expr_T22, [Forms]![fInputForm]![Text16] AS Expr_T16, [Forms]![fInputForm]![Text24] AS Expr_T24
FROM Formulas
WHERE (((Formulas.[Formula Name])=[Forms]![fInputForm]![Combo38]));

I use Combo38 from the form to pick a formula name, which gives me the Kcal Per Unit for that formulation from the Formulas table. The rest is just patient name, history number, total volume, etc., which gets typed into the form and eventually typed into a label.
 
JHHPavel . . .

The query looks fine. So as to the form ... it has to be open before you run the query and the fields in the query should have data in the form. Is this so?

[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
The form is open and all fields are filled. I ran it this morning, and everything seems to be working again. I shut down the database, re-opened, and it still worked. I'll try again this afternoon and let you know what happens.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top