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

Access Report code affects all records.

Status
Not open for further replies.

danomaniac

Programmer
Jan 16, 2002
266
US
I'm building a shipping report in access. I have in the detail section several bound text boxes. I'm trying to turn on an invisible warning label if the on hand quantity (OHQ) is less than the desired pull quantity (PQ) for that day.

Here's the setup:

In the detail section are textboxes txtPQ and txtOHQ which are bound to the underlying query which works fine.

Here's the code:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

Dim ohq As Integer
Dim pq As Integer

pq = txtPQ
ohq = txtOHQ

If pq > ohq Then
lblwarning.visible = True
End If

End Sub

Here's the problem:

If the pq > ohq condition is true for any record on the report, then the lblwarning.visible property is set to true for ALL the records on the report, not just the record where the condition is true. Any ideas?

Thanks for any help,

Dan

"It's more like it is now, than it ever has been."
 
Nevermind - Fixed it myself.

I had the code in the Detail_Format event instead of the Detail_Print. Oops.

"It's more like it is now, than it ever has been."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top