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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Field Name problem in a query.

Status
Not open for further replies.

mattfox

IS-IT--Management
May 11, 2000
26
US
I have two tables setup and in my query I have one field from one table and the rest from the other.&nbsp;&nbsp;I have the relationship setup between the two tables.&nbsp;&nbsp;In the query I prompt for an entry for a field name.&nbsp;&nbsp;When I run it I get this:<br><br>First prompt - table name.fieldname<br>Second Prompt - My question prompt for data<br><br>If I enter the correct data to be queried for at both prompts it doesn't query for anything.&nbsp;&nbsp;I am lost.
 
Could you post your SQL here?&nbsp;&nbsp;I'm sure I could help but I'm a little fuzzy on the details.<br><br>Drew
 
Drew,<br><br>I could do that but I have limited knowledge on SQL.&nbsp;&nbsp;I forgot to add this.&nbsp;&nbsp;The query works fine.&nbsp;&nbsp;This error happens when I run the macro that I created.&nbsp;&nbsp;What kind of details do you need?<br><br><br>Matt
 
It sounds as if the macro might be causing the first prompt.&nbsp;&nbsp;I'm unclear why a fieldname is being prompted for, but would guess you are running multiple actions with it.<br><br>By saying the query works fine, I assume you mean it provides all the records you hope for when run without the macro calling it.&nbsp;&nbsp;Do you have a condition set in the macro window?&nbsp;&nbsp;If so, try removing it and see what happens, it is likely redundant.<br><br>Otherwise, what other actions are you performing in the macro?<br><br>Drew
 
I am only running one action - openform and the data mode is edit.&nbsp;&nbsp;The query produces the correct data that I prompt for.
 
ahhh...ok...Let's see now.&nbsp;&nbsp;Does the form open correctly without calling it from the macro?
 
I'm trying to picture how this is set up, and I'd like to rephrase the problem to see if I'm understanding correctly.<br><br>A macro is called, which opens a form.&nbsp;&nbsp;The record source of the form is a query which prompts the user first, for a field from a table, and second, for a data criteria.&nbsp;&nbsp;Both of these prompts are intentional.<br><br>The filtered results are displayed on the form.<br><br>Am I on target with my understanding?
 
A macro is called, which opens a form after the the prompt.&nbsp;&nbsp;The filter name of the macro is a query which displays a table name (them a period) and the field from a table which I am prompting for data in the second display.&nbsp;&nbsp;The second one is intentional, the first just pops up and and it happens to be the field that I am prompting for data.&nbsp;&nbsp;The first prompt is not supposed to happen.
 
This is what I found in the filter name help in the openform macro action.&nbsp;&nbsp;<br><br>Filter Name <br><br>A filter that restricts or sorts the form's records. You can enter the name of either an existing query or a filter that was saved as a query. However, the query must include all the fields in the form you are opening or have its OutputAllFields property set to Yes.<br><br><br>It seems like we've narrowed the difficulty to this argument.&nbsp;&nbsp;Is it possible to set the form's record source directly to the query, and letting the macro's filter name be empty?<br><br>The query should continue performing the second prompt, but the first one, likely caused by the macro's filter name,&nbsp;&nbsp;might be confusing the process.<br><br><br>
 
I have ten different macros setup, so I cannot have set the form's record source directly to the query.&nbsp;&nbsp;I changed the OutputAllFields property set to Yes snd I got the same result..<br><br><br>
 
<br>(3 posts back)<br>&lt;&lt;&nbsp;&nbsp;The filter name of the macro is a query which displays a table name (them a period) and the field from a table which I am prompting for data in the second display &gt;&gt;<br><br>Could it be that the filter name should only contain the name of the query?<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top