Subform Control Not Printing

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an unbound text box on a subform. There is an On Current event
procedure for the subform that populates the box. The value shows on the
print preview for the form and prints if I print the subform alone. But it
won't print when I print the main form. This is a form I inherited from a
client and have had to incorporate into my new database, so switching to a
report is not an option. (It was working up until I added the code, and
they've used for a few years now - you know the obstables.)
Here's the procedure:
Private Sub Form_Current()
Dim Owner_Int As Double
Owner_Int = Me![Net_Acres] / Me![Gross_Tract]

If Me.Net_Acres = Me.Gross_Tract Then
Me.MinOwnerInt = 1
Else: Me.MinOwnerInt.Value = Owner_Int
End If

If Me![Net_Acres] > Me![Gross_Tract] Then
MsgBox ("Net Acres Cannot be greater than Gross Tract")
End If

End Sub
I thought of switching it to the On Current event for the Main form, but the
fact that it shows on the print preview makes me think that's not the issue.
Thanks for your help.
 
I thought it might have to do with whether or not the control was Bound or
not, but I tried duplicating your error with both a Bound and Unbound control
without success. You might try a Me.Refresh before printing.

While I empathize with wanting to disturb the client's current solution, the
bottom line is that Microsoft does not provide much functionality in printing
forms. Moreover, if the process is transparent to the user, i.e., they press
a button, and the data is printed, I'm not entirely clear on why they'd care
how it was being done.

You should be aware that the code as provided will trigger a Stack Overflow
error if you move the cursor to a new record, and the code tries to divide by
zero. Also, it seems the code should be attached to each of the calculation
constituents AfterUpdate event procedure also.

Good luck. Hope that helps.

Sprinks
 
Thanks, Spinks. Many good points.

Sprinks said:
I thought it might have to do with whether or not the control was Bound or
not, but I tried duplicating your error with both a Bound and Unbound control
without success. You might try a Me.Refresh before printing.

While I empathize with wanting to disturb the client's current solution, the
bottom line is that Microsoft does not provide much functionality in printing
forms. Moreover, if the process is transparent to the user, i.e., they press
a button, and the data is printed, I'm not entirely clear on why they'd care
how it was being done.

You should be aware that the code as provided will trigger a Stack Overflow
error if you move the cursor to a new record, and the code tries to divide by
zero. Also, it seems the code should be attached to each of the calculation
constituents AfterUpdate event procedure also.

Good luck. Hope that helps.

Sprinks


okschlaps said:
I have an unbound text box on a subform. There is an On Current event
procedure for the subform that populates the box. The value shows on the
print preview for the form and prints if I print the subform alone. But it
won't print when I print the main form. This is a form I inherited from a
client and have had to incorporate into my new database, so switching to a
report is not an option. (It was working up until I added the code, and
they've used for a few years now - you know the obstables.)
Here's the procedure:
Private Sub Form_Current()
Dim Owner_Int As Double
Owner_Int = Me![Net_Acres] / Me![Gross_Tract]

If Me.Net_Acres = Me.Gross_Tract Then
Me.MinOwnerInt = 1
Else: Me.MinOwnerInt.Value = Owner_Int
End If

If Me![Net_Acres] > Me![Gross_Tract] Then
MsgBox ("Net Acres Cannot be greater than Gross Tract")
End If

End Sub
I thought of switching it to the On Current event for the Main form, but the
fact that it shows on the print preview makes me think that's not the issue.
Thanks for your help.
 
Back
Top