Hi there!
I have recently created a function that picks out a credit card charge rate and then applies this against a credit card payment in a textbox on a form.
I.e. txtCreditCardCharge: Round([txtPreBookedCard]*CardCharge(“ChargeRate”),2)
What puzzles me is when I open the respective form there is a noticeable delay in how long it takes the txtCreditCardCharge field to display the value in its field. Other fields on the form are drawn direct from a table called payments.
Can anyone advise me as to why this is the case? Could it be the code in the function? I’ve posted it below. (incidentally there is currently only one record in tblCardDetails)
Cheers,
Niven
Public Function CardCharge(ByVal ChargeRate)
Dim rsChargeRate As Recordset
Dim strSQL2 As String
Dim strChargeRate As Double
strSQL2 = “SELECT ChargeRate from tblCardDetails where CardType = ‘CC'”
Set rsChargeRate = CurrentDb.OpenRecordset(strSQL2)
rsChargeRate.MoveFirst
strChargeRate = rsChargeRate(“ChargeRate”)
rsChargeRate.Close
Set rsChargeRate = Nothing
CardCharge = strChargeRate
End Function