krazykasper
Registered User.
- Local time
- Today, 11:26
- Joined
- Feb 6, 2007
- Messages
- 35
I really appreciate any help you can provide. Although I am only vaguely familiar with VBA I think my problem has to do with the way I am naming things or the “Select Case” statement in my code.
In my report:
The text box is named txt_MyPrice
The Control Source is =mod_CreditItem()
In my code:
The name of the Module is mod_CreditItem
In the database:
The table that houses the data is dbo_InvoiceDetail (accessed via ODBC)
The fields in the table are named: BillingType and ExtPrice
When using the following code, the report asks me to input data for that module name, when in fact it should get the fields from the database tables; modify them as per the Case and Case Else Statements and display them in the report.
Following is my current code:
Option Compare Database
Public Function mod_CreditItem()
Dim ShippingFactor As Integer
Select Case dbo_InvoiceDetail.BillingType
Case "RE", "G2", "S1", "ZLG2", "ZZSA", "ZZG2", "ZZSR"
ShippingFactor = -1
Case Else
ShippingFactor = 1
End Select
mod_CreditItem = dbo_InvoiceDetail.ExtPrice * ShippingFactor
End Function
Thanks for your help.
Krazy (Bill) Kasper
In my report:
The text box is named txt_MyPrice
The Control Source is =mod_CreditItem()
In my code:
The name of the Module is mod_CreditItem
In the database:
The table that houses the data is dbo_InvoiceDetail (accessed via ODBC)
The fields in the table are named: BillingType and ExtPrice
When using the following code, the report asks me to input data for that module name, when in fact it should get the fields from the database tables; modify them as per the Case and Case Else Statements and display them in the report.
Following is my current code:
Option Compare Database
Public Function mod_CreditItem()
Dim ShippingFactor As Integer
Select Case dbo_InvoiceDetail.BillingType
Case "RE", "G2", "S1", "ZLG2", "ZZSA", "ZZG2", "ZZSR"
ShippingFactor = -1
Case Else
ShippingFactor = 1
End Select
mod_CreditItem = dbo_InvoiceDetail.ExtPrice * ShippingFactor
End Function
Thanks for your help.
Krazy (Bill) Kasper