Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / January 2005

Tip: Looking for answers? Try searching our database.

#Name? displayed in a text box (Access 2003)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
OldStoneBuddha - 08 Jan 2005 18:56 GMT
I have an error that is driving me nuts...
I have an unbound form in which I want to display the results of a query in
a textbox.  The query evaluates correctly, but the textbox displays #Name?
instead of the value from the query.  What is going on?

I apologize if this seems a silly question as I am a learning Access.

Thanks in advance!
fredg - 08 Jan 2005 19:04 GMT
> I have an error that is driving me nuts...
> I have an unbound form in which I want to display the results of a query in
[quoted text clipped - 4 lines]
>
> Thanks in advance!

And the actual control source of the unbound text box is ....?
And the name of the unbound text box is ....?
Signature

Fred
Please only reply to this newsgroup.
I do not reply to personal email.

John Vinson - 08 Jan 2005 21:34 GMT
>I have an error that is driving me nuts...
>I have an unbound form in which I want to display the results of a query in
[quoted text clipped - 4 lines]
>
>Thanks in advance!

The Control Source property of the textbox should be EITHER the name
of a field in the Form's Recordsource query; OR an expression in its
own right, preceded by an equals sign,  e.g.

=[ThisField] + [ThatField];

OR a Domain Function call to look up the value from a query:

=DLookUp("[ResultField]", "[QueryName]", "optional criteria string")

My guess is that you're just putting the name of the query, or
queryname.fieldname, in the control source: that will NOT work.

                 John W. Vinson[MVP]
OldStoneBuddha - 08 Jan 2005 22:05 GMT
You hit the nail on the head. I was using the queryname.fieldname in the
control source.  I will try the dlookup function.  The problem I'm trying to
solve is a wierd one,  you can read on if your intrested...

I'm sure there is a more elegant way to do this, but here goes...
What I'm trying to do is display multiple records on one form.  I'm easily
able to do that by setting a form's (bound to a query) default view to
Continuous Forms.  The problem is that in the query results I'm trying to
display, I need to show the records in a custom sort order.  The records
returned from the query have three primary keys, TrayName(text),
ColNumber(integer), and
RowNumber(integer).  When I display the records for a particular TrayName, I
need them sorted by the ColNumber, then the RowNumber.  The tricky part is
that on odd number rows, the columns must be sorted Ascending (1-6) and on
even rows the columns must be sorted decending (6-1).  (This is the way users
will enter data, and is based on how the users generate the readings from a
microscope tray.  It's called serpentine reading.)  I can't figure a way to
do this in reports or forms with the built in Access sort orders, so...

To get around this problem, I tried creating an unbound form, and dropping
individual textboxes on it.  Then I generated unique queries for each well on
the tray (96 of them) and tried to link the Record Source property for each
textbox to the appropriate query.  The queries work fine, but the text boxes
on the form just display "#Name?".  

For example: the textbox (Text2) that is supposed to display Row1, Column1
for the selected tray has the following query as its control source:
=Trayr1c1!ABOCtr.  That query looks like this: SELECT [Prelim 180
Query].CellTxt, [Prelim 180 Query].ABOCtr
FROM [Prelim 180 Query]
WHERE ((([Prelim 180 Query].TrayNm)=[Forms]![Navigator]![TraySelect]) AND
(([Prelim 180 Query].RowNbr)=1) AND (([Prelim 180 Query].ColNbr)=1));

I've been trying to figure this out for DAYS...any suggestions would be
greatly appreciated.

Peace,
OldStoneBuddha

> >I have an error that is driving me nuts...
> >I have an unbound form in which I want to display the results of a query in
[quoted text clipped - 19 lines]
>
>                   John W. Vinson[MVP]
John Vinson - 10 Jan 2005 00:10 GMT
>The records
>returned from the query have three primary keys, TrayName(text),
>ColNumber(integer), and RowNumber(integer).  

Jargon nitpick: you have ONE Primary Key consisting of three fields.
The primary key is by definition unique - <Highlander.There Can Only
Be One</Highlander>

>When I display the records for a particular TrayName, I
>need them sorted by the ColNumber, then the RowNumber.  The tricky part is
[quoted text clipped - 3 lines]
>microscope tray.  It's called serpentine reading.)  I can't figure a way to
>do this in reports or forms with the built in Access sort orders, so...

Ok... put a calculated field in the Query:

SortCol: IIf([RowNumber] MOD 2 = 0, 7 - [ColNumber], [ColNumber])

and sort by TrayName, SortCol, and RowNumber.

Glad to be able to help!

                 John W. Vinson[MVP]
OldStoneBuddha - 08 Jan 2005 22:37 GMT
edMr. Vinson,

THANK YOU!!!  That solved it.  I put the following in my control source:
=DLookUp("[CellTxt]","[Prelim 180 Query]","[RowNbr] = 1 AND [ColNbr] =1")
and viola!  You have helped me a great deal, and you have my gratitude.  My
problem is that I am a old EXCEL user & VB person who is now realizing the
great benefits of ACCESS.  However, some skills don't port over well to
ACCESS.  In VB, I could just set the textbox field's Value property to
whatever I wanted.  ACCESS has some stricter rules...but I will learn.
Again, Thank You!

Peace,

Scott D. Collins, CHS(ABHI)
Laboratories At Bonfils
Denver, CO
work: scollins@labsatbonfils.com
home: oldstonebuddha@comcast.net

> >I have an error that is driving me nuts...
> >I have an unbound form in which I want to display the results of a query in
[quoted text clipped - 19 lines]
>
>                   John W. Vinson[MVP]
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.