Hello,
Is it possible?? VBA Code is stopping from one AfterUpdate to another AfterUpdate event ??
I have created a invoice creation form & using DLOOKUP for customer details update purpose on AfterUpdate Event. That is CID and Customer fields...
Some times that fields are using manual entry without DLOOKUP because adding new customer details & Data modifying. So on the time no need to use DLOOKUP option on AfterUpdate event and need to stopping VBA from CID AfterUpdate event to Customer AfterUpdate event Or i need in the both of fields our choice wise.
that option i need under DCount condtion for both Procedures. Could you please help!
VBA:
Is it possible?? VBA Code is stopping from one AfterUpdate to another AfterUpdate event ??
I have created a invoice creation form & using DLOOKUP for customer details update purpose on AfterUpdate Event. That is CID and Customer fields...
Some times that fields are using manual entry without DLOOKUP because adding new customer details & Data modifying. So on the time no need to use DLOOKUP option on AfterUpdate event and need to stopping VBA from CID AfterUpdate event to Customer AfterUpdate event Or i need in the both of fields our choice wise.
that option i need under DCount condtion for both Procedures. Could you please help!
VBA:
Private Sub CID2_AfterUpdate()
On Error GoTo ErrorHandler
If DLookup("[TrNo]", "RelationsQry", "RID= '" & Me!CID2 & "'") Then
Me!CID1 = DLookup("[TrNo]", "RelationsQry", "RID= '" & Me!CID2 & "'")
Me!Customer = DLookup("[RName]", "RelationsQry", "RID= '" & Me!CID2 & "'")
Me!Address = DLookup("[Address]", "RelationsQry", "RID= '" & Me!CID2 & "'")
Me!TinNumber = DLookup("[TinNumber]", "RelationsQry", "RID= '" & Me!CID2 & "'")
Me!TownVLG = DLookup("[TownVLG]", "RelationsQry", "RID= '" & Me!CID2 & "'")
Else
Dim StrCriteria As String
StrCriteria = "CIDCST = '" & Trim((Me!CID2) & " " & Trim(Me!Customer)) & "'"
If DCount("*", "RelationsQry", StrCriteria) <= 0 Then
Me.CID1.Value = Null
Me.Customer.Value = Null
Me.Address.Value = Null
Me.TinNumber.Value = Null
Me.TownVLG.Value = Null
End If
' I need that option in this place
End If
ErrorHandler:
End Sub
----------------------------------------------------
Private Sub Customer_AfterUpdate()
On Error GoTo ErrorHandler
If DLookup("[TrNo]", "RelationsQry", "RName= '" & Me!Customer & "'") Then
Me!CID1 = DLookup("[TrNo]", "RelationsQry", "RName= '" & Me!Customer & "'")
Me!CID2 = DLookup("[RID]", "RelationsQry", "RName= '" & Me!Customer & "'")
Me!Address = DLookup("[Address]", "RelationsQry", "RName= '" & Me!Customer & "'")
Me!TinNumber = DLookup("[TinNumber]", "RelationsQry", "RName= '" & Me!Customer & "'")
Me!TownVLG = DLookup("[TownVLG]", "RelationsQry", "RName= '" & Me!Customer & "'")
Else
Dim StrCriteria As String
StrCriteria = "CIDCST = '" & Trim((Me!CID2) & " " & Trim(Me!Customer)) & "'"
If DCount("*", "RelationsQry", StrCriteria) <= 0 Then
Me.CID1.Value = Null
Me.CID2.Value = Null
Me.Address.Value = Null
Me.TinNumber.Value = Null
Me.TownVLG.Value = Null
End If
' I need that option in this place
End If
ErrorHandler:
End Sub