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 / Forms Programming / April 2005

Tip: Looking for answers? Try searching our database.

Supress "#Error" in a Textbox

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MSA - 29 Apr 2005 11:04 GMT
I have a text box-(MainForm) that is reading a value from a subtotal text
box-(subform) from a subform.

When the form is opened initially it always has an "#Error" in this text
box-(MainForm) as a result of subtotal on the subform not having a value to
sum, thus causing the error.

So I tried using the following code in the Control Source property of my
text box-(MainForm) but I keep getting an error message "saying the
expression you entered contains invalid syntax".

=IIf([x_F_Area subform].[Form].[RecordsetClone].[RecordCount] = 0, 0,
Nz([x_F_Area subform].[Form].[Text10],0))

Would appreciate if someone could point out where the above expression is
wrong.

Thanks!
Dennis - 29 Apr 2005 11:20 GMT
try this instead

=iif(IsError([TextBox]),0,[TextBox])

> I have a text box-(MainForm) that is reading a value from a subtotal text
> box-(subform) from a subform.
[quoted text clipped - 14 lines]
>
> Thanks!
MSA - 29 Apr 2005 11:29 GMT
Tried to put the suggested expression but am unable to do - so as before I
keep getting the same error msg. saying the "expression you entered contains
invalid syntax".

Currently the text box-(MainForm) contains the following to read the textbox
on the subform:
=[x_F_Area subform].Form!Text10

> try this instead
>
[quoted text clipped - 18 lines]
> >
> > Thanks!
Dennis - 29 Apr 2005 11:42 GMT
I think your syntax should just be
=[x_F_Area subform]!Text10

> Tried to put the suggested expression but am unable to do - so as before I
> keep getting the same error msg. saying the "expression you entered contains
[quoted text clipped - 26 lines]
> > >
> > > Thanks!
MSA - 29 Apr 2005 13:00 GMT
Thanks for the pointer there, but that code is working fine (i.e. it is able
to read what is in the textbox on the subform). Now how do I get your
suggested solution incorporated in the Text box-(Main form)?

=iif(IsError([TextBox]),0,[TextBox])

It keeps coming up with a error msg "expression you entered contains invalid
syntax".

> I think your syntax should just be
> =[x_F_Area subform]!Text10
[quoted text clipped - 29 lines]
> > > >
> > > > Thanks!
Dennis - 29 Apr 2005 13:12 GMT
Is it just as simple as putting the iif IsError around the field on the sub
form instead ?

> Thanks for the pointer there, but that code is working fine (i.e. it is able
> to read what is in the textbox on the subform). Now how do I get your
[quoted text clipped - 38 lines]
> > > > >
> > > > > Thanks!
MSA - 29 Apr 2005 13:44 GMT
Forgive my ignorance as I just started developing with access/forms.

Where excactly should I put your suggested code

Here is the layout
Subform Textbox (named Text10) Control Source Property has:
=Sum([Quantity SSU])

Which is being read by the other Text box (named Text16) on the Main form
Mainform Textbox Control Source Property has:
=[x_F_Area subform].Form!Text10

Given the above where should I put the code, thanks.

> Is it just as simple as putting the iif IsError around the field on the sub
> form instead ?
[quoted text clipped - 41 lines]
> > > > > >
> > > > > > Thanks!
Dennis - 29 Apr 2005 13:50 GMT
in the control source of Text10 on your subform
=iif(IsError(Sum([Quantity SSU])),0,Sum([Quantity SSU]))

> Forgive my ignorance as I just started developing with access/forms.
>
[quoted text clipped - 55 lines]
> > > > > > >
> > > > > > > Thanks!
Marshall Barton - 29 Apr 2005 15:25 GMT
Try using two text boxes on the main form.  Make a new one
named txtSubTotal and set its  Visible property to No and
control source expression to:
    =[x_F_Area subform].Form!Text10
This text box will have #Error, but since it's invisible it
won't matter.

Now your existing text box can use Dennis' expression:
    =IIf(IsError([txtSubTotal]), 0, [txtSubTotal])
Signature

Marsh
MVP [MS Access]

>Thanks for the pointer there, but that code is working fine (i.e. it is able
>to read what is in the textbox on the subform). Now how do I get your
[quoted text clipped - 38 lines]
>> > > >
>> > > > Thanks!
 
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.