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

Query Criteria to run a report

Status
Not open for further replies.

dawnd3

Instructor
Jul 1, 2001
1,153
0
0
US
Hi there, I am trying to open a report based on a query that is basing it's criteria on a form field. I do this all the time and for some reason I am having trouble. The field in the query is called [afnumber] from the adoptive family table. In the criteria I have put
Forms![Adopting Family - Update Form]![Adoptive Family.afnumber]

The reason I have put Adoptive family.afnumber is because the form has more than one afnumber field. In addition I used the build button to make sure my syntax was correct. I am thinking that the spaces in the name is what is messing me up. I didn't build the database so I can't just change the names of fields.

Here is the error I get when I try to run this query. "Invalid bracketing of names..." If I take out the table name from the field name it runs the query but gives no results. If I put brackets around each of the table name and the field name it prompts me for a parameter value not recognizing the form name.

I have checked and double checked spelling, spaces etc. I have even created a button on the form that pops up a message box with the afnumber in it to see if it would recognize the syntax in VBA and it was fine.

Please help.

Thanks

Dawn
 
You may want to check your syntax.

Is the exact name of your form "Adopting Family - Update Form" and is the EXACT name of the field you are trying to use "Adoptive Family.afnumber"?

Maybe it should read FORMS![Adopting Family].[afnumber]

If the field's name is afnumber, I don't see why the build name it "Adoptive Family.afnumber". If Adoptive Family.afnumber is the name of your field, then maybe you may want to consider taking the period out. Maybe there is a conflict.

Let me know if this helps.
Deb
 
Yes that is the exact name of the form. (I didn't name it) :) The field name is afnumber but it was automatically named in the query underlying the form "Adoptive family.afnumber" because there is more than one afnumber in the query/form due to other tables having the same named field. I tried taking the period out and also tried putting brackets around each of the table name and field separetly. No luck. Thanks for responding. Let me know if you have any other ideas.

Dawn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top