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 Linked to Form showing #Error

Status
Not open for further replies.

OwenHall

Technical User
Jul 23, 2002
21
GB
On my Access 97 form 'frmGroup' I am populating text boxes using a subform 'frmSelections', who source is a query 'qryProductCostTypeA'.

When qryProductCostTypeA is empty, frmSelections comes up blank and so the textboxes on frmGroup are populated with the '#Error' message.

An IIF statement using the 'Is Null' statement will not work on the text boxes on frmGroup as the '#Error' message is in the box.

All I want is for the textboxes to have the value '0' when the query/subform is null, so that I can do a calculation on the text box.

Can anyone help?
 
Hi OwenHall

In the OnLoad event of the form frmGroup add copy and place in the following ...

'start here
If IsNull(Me![frmSelections].Form![Codes]) Or Me![frmSelections].Form![Codes] Then
Me.your_text_field.Value = "0"
Else
Me.your_text_field.Value = Me![frmSelections].Form![Codes]
End If
'end here

Replace "your_text_field" for the text field name you want.

Make sure on the form frmGroup, the text field's control source is empty. IE it is an unbound field and this should work ...

Tiny

Perfection is Everything
If it worked first time we wont be here!
 
Thanks Tiny,

I shall tru this out and see what happens.
 
I tried it out but could not get it to work. I kept getting errors when trying to open or load the form.
 
Still need help on this one.

When I say the SQL is Blank I mean that when it is run the result brings back nothing under the field names.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top