Hiding Errora in Form Field

  • Thread starter khashid via AccessMonster.com
  • Start date
K

khashid via AccessMonster.com

I have a form and subform. In the subform I have made a textbox "SubCount"
that counts the number of records.
On the main form I have created a new textbox "MainCount" and linked it to
the textbox in subform SubCount. so it shows the same record.

The issue am facing is that SubForm is based on a query and search fields.
Sometime the Subform is Blank means when can not find any date. When the
Subform is free the MainCount shows me erros "#Error". How can I hide that
error message so it can be 0 or Just simply blank when Subform has no data
 
G

Guest

Try using the function IsError

=IIf(IsError([SubFormName].Form.[TextBoxName]) , 0 ,
[SubFormName].Form.[TextBoxName])
 
K

khashid via AccessMonster.com

I already have following as control source

=[CSRInbound Subform].Form!Count

Ofer said:
Try using the function IsError

=IIf(IsError([SubFormName].Form.[TextBoxName]) , 0 ,
[SubFormName].Form.[TextBoxName])
I have a form and subform. In the subform I have made a textbox "SubCount"
that counts the number of records.
[quoted text clipped - 5 lines]
Subform is free the MainCount shows me erros "#Error". How can I hide that
error message so it can be 0 or Just simply blank when Subform has no data
 
G

Guest

Not sure what you are trying to tell me, did you try the IsError?

e.g:
In the sub form create a text box, in the control source write
=Count(*)

That wil return the number of records in the sub form
*****************************************
In the main form create a text box, in it write
=IIf(IsError([CSRInbound Subform].Form!TextBoxName,0,[CSRInbound
Subform].Form!TextBoxName)

It will replace the error with 0

--
Good Luck
BS"D


khashid via AccessMonster.com said:
I already have following as control source

=[CSRInbound Subform].Form!Count

Ofer said:
Try using the function IsError

=IIf(IsError([SubFormName].Form.[TextBoxName]) , 0 ,
[SubFormName].Form.[TextBoxName])
I have a form and subform. In the subform I have made a textbox "SubCount"
that counts the number of records.
[quoted text clipped - 5 lines]
Subform is free the MainCount shows me erros "#Error". How can I hide that
error message so it can be 0 or Just simply blank when Subform has no data
 
G

Guest

Not sure what you are trying to tell me, did you try the IsError?

e.g:
In the sub form create a text box, in the control source write
=Count(*)

That wil return the number of records in the sub form
*****************************************
In the main form create a text box, in it write
=IIf(IsError([CSRInbound Subform].Form!TextBoxName),0,[CSRInbound
Subform].Form!TextBoxName)

It will replace the error with 0

--
Good Luck
BS"D


khashid via AccessMonster.com said:
I already have following as control source

=[CSRInbound Subform].Form!Count

Ofer said:
Try using the function IsError

=IIf(IsError([SubFormName].Form.[TextBoxName]) , 0 ,
[SubFormName].Form.[TextBoxName])
I have a form and subform. In the subform I have made a textbox "SubCount"
that counts the number of records.
[quoted text clipped - 5 lines]
Subform is free the MainCount shows me erros "#Error". How can I hide that
error message so it can be 0 or Just simply blank when Subform has no data
 
K

khashid via AccessMonster.com

I did the same but it gives me erroe #Name, if i remove IsError then it just
simply gives me "0"

Ofer said:
Not sure what you are trying to tell me, did you try the IsError?

e.g:
In the sub form create a text box, in the control source write
=Count(*)

That wil return the number of records in the sub form
*****************************************
In the main form create a text box, in it write
=IIf(IsError([CSRInbound Subform].Form!TextBoxName),0,[CSRInbound
Subform].Form!TextBoxName)

It will replace the error with 0
I already have following as control source
[quoted text clipped - 10 lines]
 
K

khashid via AccessMonster.com

If i use IIF , and count the records in subform if they r above 0 then gives
me the count if <0 then shows me "0" . is that possible?

Ofer said:
Not sure what you are trying to tell me, did you try the IsError?

e.g:
In the sub form create a text box, in the control source write
=Count(*)

That wil return the number of records in the sub form
*****************************************
In the main form create a text box, in it write
=IIf(IsError([CSRInbound Subform].Form!TextBoxName,0,[CSRInbound
Subform].Form!TextBoxName)

It will replace the error with 0
I already have following as control source
[quoted text clipped - 10 lines]
 
K

khashid via AccessMonster.com

If i use IIF , and count the records in subform if they r above 0 then gives
me the count if <0 then shows me "0" . is that possible?
I did the same but it gives me erroe #Name, if i remove IsError then it just
simply gives me "0"
Not sure what you are trying to tell me, did you try the IsError?
[quoted text clipped - 15 lines]
 
D

Dirk Goldgar

In
khashid via AccessMonster.com said:
I have a form and subform. In the subform I have made a textbox
"SubCount" that counts the number of records.
On the main form I have created a new textbox "MainCount" and linked
it to the textbox in subform SubCount. so it shows the same record.

The issue am facing is that SubForm is based on a query and search
fields. Sometime the Subform is Blank means when can not find any
date. When the Subform is free the MainCount shows me erros "#Error".
How can I hide that error message so it can be 0 or Just simply blank
when Subform has no data

http://www.mvps.org/access/forms/frm0022.htm
Forms: #Error when the Subform has no records
 
K

khashid via AccessMonster.com

This is excellent, can you tell me where should i put this code, on the main
or subform, can I use it "On Load" of subform or main form?

Dirk said:
I have a form and subform. In the subform I have made a textbox
"SubCount" that counts the number of records.
[quoted text clipped - 6 lines]
How can I hide that error message so it can be 0 or Just simply blank
when Subform has no data

http://www.mvps.org/access/forms/frm0022.htm
Forms: #Error when the Subform has no records
 
D

Dirk Goldgar

In
khashid via AccessMonster.com said:
This is excellent, can you tell me where should i put this code, on
the main or subform, can I use it "On Load" of subform or main form?

Paste the function code in a standard module. Then set the
controlsource of your MainCount text box to this:

=nnz([YourSubformName]![SubCount]

where "YourSubformName" is the name of the subform control (on the main
form) that displays the subform, and "SubCount" is the name of the text
box on the subform whose data you want to show.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top