#Name Error on Calculated Text Box on Form (1 Viewer)

scuddersm

Registered User.
Local time
Yesterday, 23:24
Joined
Mar 9, 2011
Messages
31
Hello all,

I am having some issues with this error showing up on my forms. I have a calculated field that is the result of 2 queries. The first query gives me the count of assigned and trained personnel and the second query divides the results and displays a percentage. Both of the queries run correctly and display the results. However when I try and attach the percentage field from the query to a txt box on my form I get a #name? error. I have tried numerous things to fix it with no sucess. I have included a sample of what I am doing to see if anyone out there has the answer. Its probably a quick fix but it currently eludes me.

Thanks for any help!

Scott
 

Attachments

  • Calculate Percents.accdb
    512 KB · Views: 147

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 20:24
Joined
Aug 30, 2003
Messages
36,125
You can't refer to it that way. If the field isn't in the form's record source, you can use a DLookup to get the value:

=DLookUp("[Pct]","[qryYB Pct]")
 

boblarson

Smeghead
Local time
Yesterday, 20:24
Joined
Jan 12, 2001
Messages
32,059
Sorry, you can't refer to a query like that from a text box. You can bind the form to that query and then bind that control to that field or you can use a DLookup:

=Nz(DLookUp("Pct","[qryYB Pct]"),0)
 

scuddersm

Registered User.
Local time
Yesterday, 23:24
Joined
Mar 9, 2011
Messages
31
You guys are awesome!! Fixed problem. Even was able to use conditional formating to color code my results. Thanks again
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 20:24
Joined
Aug 30, 2003
Messages
36,125
No problemo!
 

Users who are viewing this thread

Top Bottom