------------------------------
Hi John,
I have a Form "New Cargo Collection Input" on its sub form "NewCargoCollectionInputsubform".
This sub form has a Text box "Rate" -->Standard, Decimal Places--> 2 on its On Got Focus event i
have this code:
Private Sub Rate_GotFocus()
On Error Resume Next
Dim varRate As Double
varRate = DLookup("DestinationRate", "tblDestinationRates", _
"Destination = '" & Me.cmbDestination & _
"' AND ProductID = " & Me.ProductID & "")
Me.Rate = Nz(varRate, 0)
End Sub
The issue is that if i omit the line "On Error Resume Next" i get an error message
Run-time error '94' Invalid use of Null
This happens when in "tblDestinationRates" there is no entry for Destination and ProductID
which is selected in sub form.
There is a form "Add New Destination Freight Rates" in which "DestinationRate" are entered for a
specific Destination and ProductID when needed.
I need to know that is putting the line "On Error Resume Next" correct approach and logic ?
In this case, if there is no entry for Destination and ProductID. Text Box "Rate" shows 0.00 value
and user enters value of his choice, else it picks the value from tblDestinationRates
Regards,
Khalid
Posted by: khalidtanweerburrah@yahoo.com
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (4) |
Tidak ada komentar:
Posting Komentar