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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I force a subform record to create? 1

Status
Not open for further replies.

Tekay

MIS
Oct 25, 2002
24
US
Hi,

I have tried posting this before without success. I appologise if I am repeating myself but I am assuming that I did not explain my problem properly befor.

I have a Main form that requires a shipped quantity from a subform to calculate what's left to ship.

When I initially key a NEW record in the Main form, I do not have shipments so there are no 'associated' ship records in the shipment subform. All that I get returned is BLANK.

How can I get over this hurdle?..

In my main entry form I can see 0 and my balance to ship calculation works (text field) but when I run my report to show shipments and balance to ship, it only displays blanks.

I need to somehow force 0 into the blanks, or make a macro to force the creation of a associated ship record with 0 qty. but I don't know how to do that.

Hope someone will be kind enough to reply to this thread.

Thanks

Tekay
 
When you are doing a calculation, all the calculation fields involved need to be numeric. Therefore, at the field where is blank, use the NZ function to force it as zero(0). Try

NZ(BlankField,0)

in wherever you want to force the blank field into 0 (the NZ function so powerful that it can actually force it into anything you want, in this case, you need a 0). I hope this solve your problem.
 
Have you tried setting the Default value of the field to zero?
If that does not work then try this, in the Control Source for the field type this code:

IIf(Isnumeric(your field name), your field name, 0)
 
Thanks guys!.. I tried to reply a few mins ago but it didn't work I used HomeAlone's solution and it worked great..

Tekay
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top