Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics GP (Archived)

VBA event

Posted on by Microsoft Employee

Hi,


By some reason I don't know this: AfterLostFocus() event is not working automatically , why? it's used to work.

Private Sub Nmordencompracliente_AfterLostFocus()

Dim valor As Integer
 If (Me.Nmordencompracliente.Value <> "") Then
 valor = BuscarNumeroBl(Me.Nmordencompracliente.Value)
 If valor > 0 Then
MsgBox "¡Este número ya existe " + CStr(valor) + " Veces! (O_o)"
End If
End If
End Sub

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: VBA event

    You are helping me, I'm glad! never mind to make any questions, I did what you said, and it worked (the break point). Thanks, my friend.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: VBA event

    Hi, it worked, and BuscarNumeroBl is a S_Procedure, I realized that my sql connection user had not permission to this SP. Thanks! you are really good guys!.

  • Verified answer
    Almas Mahfooz Profile Picture
    Almas Mahfooz 11,003 User Group Leader on at
    RE: VBA event

    AfterLostFocus is working for me. I am not sure about BuscarNumeroBl (what is this doing), I have just change your code a little and it should work.

    Private Sub Nmordencompracliente_AfterLostFocus()
    
    Dim valor As Integer
    
    If (Me.Nmordencompracliente.Value <> "") Then
            
            If BuscarNumeroBl(Me.Nmordencompracliente.Value) > 0 Then
                  MsgBox "¡Este número ya existe " + CStr(valor) + " Veces! (O_o)"
            End If
            
    End If
    
    End Sub
  • Tim Foster Profile Picture
    Tim Foster 8,515 on at
    RE: VBA event

    I'm sorry if this seems like a silly question, but...

    If you set a breakpoint on your first "If" statement,  the code never executes?

    The VBA project could be corrupt.

    Tim

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans