Tricia_K
05-05-2008, 11:32 PM
Hello All,
This is my first post. I am very new to Access and have no experience with VBA. So please understand if I use the wrong terminology or if I am trying to do this using the wrong approach.
Here is what I am trying to do. From a subreport, I would like the [Sentence], [UnitPrice], [Discount] and [Quantity] fields hidden when the [ProductID] = 52 (Adjustment / Credit).
The name of the subreport is “Order Details Extended subreport”. I am just trying to show an Adjustment / Credit to an invoice and would prefer to do this as a “negatively priced product” to reduce the cost of the actual sale as opposed to just entering a negative payment. I need the invoice to accurately reflect the real amount paid minus adjustments. And I don’t want all the extra fields to display when the record is an adjustment. All my forms and reports work correctly so far.
After hours of searching here is what I have done. From the subreport’s detail section, in the On Format property, I have entered the Event Procedure listed below.
This does hide the sentence field (a concatenated text string) but the quantity field remains visible even when ProductID = 52. Could this have something to do with the format of the field? The code snippet below says “As Integer”? If this could be part of the problem the UnitPrice is formatted as Currency, the Quantity as general number and Discount as percent – if you need this???
As I could not get the code to hide the quantity field I did not go any further. I think I know that much, that when one variable is not working stop adding to the mix. I really have no idea what I am doing in VBA I just have a knack for looking for code snippets that seem to fit the bill and amending them to my purpose.
Can someone please help me? I appreciate any and all instruction. Please note if you say do this XYZ please mention where I should put XYZ. Thank you.
Trish
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If ProductID = 52 Then
Me.Sentence.Visible = False
Else
Me.Sentence.Visible = True
End If
End Sub
Private Sub Quantity_Detail_Format(Cancel As Integer, FormatCount As Integer)
If ProductID = 52 Then
Me.Quantity.Visible = False
Else
Me.Quantity.Visible = True
End If
End Sub
This is my first post. I am very new to Access and have no experience with VBA. So please understand if I use the wrong terminology or if I am trying to do this using the wrong approach.
Here is what I am trying to do. From a subreport, I would like the [Sentence], [UnitPrice], [Discount] and [Quantity] fields hidden when the [ProductID] = 52 (Adjustment / Credit).
The name of the subreport is “Order Details Extended subreport”. I am just trying to show an Adjustment / Credit to an invoice and would prefer to do this as a “negatively priced product” to reduce the cost of the actual sale as opposed to just entering a negative payment. I need the invoice to accurately reflect the real amount paid minus adjustments. And I don’t want all the extra fields to display when the record is an adjustment. All my forms and reports work correctly so far.
After hours of searching here is what I have done. From the subreport’s detail section, in the On Format property, I have entered the Event Procedure listed below.
This does hide the sentence field (a concatenated text string) but the quantity field remains visible even when ProductID = 52. Could this have something to do with the format of the field? The code snippet below says “As Integer”? If this could be part of the problem the UnitPrice is formatted as Currency, the Quantity as general number and Discount as percent – if you need this???
As I could not get the code to hide the quantity field I did not go any further. I think I know that much, that when one variable is not working stop adding to the mix. I really have no idea what I am doing in VBA I just have a knack for looking for code snippets that seem to fit the bill and amending them to my purpose.
Can someone please help me? I appreciate any and all instruction. Please note if you say do this XYZ please mention where I should put XYZ. Thank you.
Trish
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If ProductID = 52 Then
Me.Sentence.Visible = False
Else
Me.Sentence.Visible = True
End If
End Sub
Private Sub Quantity_Detail_Format(Cancel As Integer, FormatCount As Integer)
If ProductID = 52 Then
Me.Quantity.Visible = False
Else
Me.Quantity.Visible = True
End If
End Sub