Hi John,
Thanks for answering.
Actually my question was simply to know that my code is working and giving me no error on getting Focus to the control "Rate", whether it is correct or there is some other method or way to define the code, particularly the line:
==> On Error Resume Next
The event is as follows:
Private Sub Rate_GotFocus()
On Error Resume Next
If IsNull(WeightOfCarton) Then
MsgBox "Oops you forget to enter Weight Of Carton." & vbCrLf & _
"Please enter Gross Weight." _
, vbExclamation, "Missing Entry"
WeightOfCarton.SetFocus
End If
Dim varRate As Double
varRate = DLookup("DestinationRate", "tblDestinationRates", _
"Destination = '" & Me.cmbDestination & _
"' AND ProductID = " & Me.ProductID & "")
Me.Rate = Nz(varRate, 0)
End Sub
I did tried with the code you suggested to see the results, but i'm sorry i don't know what should be written On Error Statement ?
Also please see first para of my this reply, i needed answer for that. Even if you suggest to use your code then please tell me what should be the On Error statement. Sorry for my limited knowledge.
Regards,
Khalid
---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :
Khalid-
You can test for empty entries like this (right after the On Error statement):
If (Len(Me.cmbDestination & "") = 0) Or (Len(Me.ProductID & "") = 0 Then
' Take alternative action - don't try to lookup the rate
Else
varRate = DLookup( ….
Me.Rate = NZ(varRate, 0)
End If
John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
(Paris, France)
On Apr 9, 2017, at 7:02 PM, khalidtanweerburrah@... [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
__._,_.___
Posted by: khalidtanweerburrah@yahoo.com
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (8) |
Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.
.
__,_._,___
Tidak ada komentar:
Posting Komentar