Print Page | Close Window

Code to Prevent Duplication

Printed From: Microsoft Dynamics Forums
Category: Microsoft Dynamics SL (Solomon)
Forum Name: SL - Customization and Integration
Forum Discription: Customization Manager, VBA, BSL, Tools for Visual Basic (VBTools), SDK, Solomon Object Model, Crystal Reports, Transaction Import, Templates, and related topics
URL: http://www.MicrosoftDynamicsForums.com/forums/forum_posts.asp?TID=7570
Printed Date: October 20 2019 at 1:59am


Topic: Code to Prevent Duplication
Posted By: LisaA
Subject: Code to Prevent Duplication
Date Posted: April 20 2018 at 5:03am

Hi, I am relatively new to doing customizations in Dynamics SL and I am attempting to prevent the user from putting in a duplicated customer PO in the sales order screen for Dynamics SL. However after putting in the code, I am getting an error message that the VBA could not be compiled for execution.

I know something is wrong with the code but I cannot figure it out so I will be greatly appreciative is someone could tell me what I am doing wrong. I have pasted the code that I have on the screen so far. Thanks so much in advance

Private Sub ccustordnbr_0_Chk(ChkStrg As String, retval As Integer)

Dim SqlStr As String

SqlStr = "Select custordnbr from soheader where custid = " + SParm(sivMyApp.Controls("Ccustid_0").value)
SqlStr = SqlStr + " and custordnbr = " + SParm(ChkStrg)

serr1 = SqlFetch1(c1, SqlStr, bcustordnbr, LenB(bcustordnbr))
    
    If serr1 <> NOTFOUND Then
        Call MsgBox(" PO number has already been entered for this customer. Please re-enter or cancel document.", vbOKOnly, "ERROR")
        retval = ErrNoMess
    
    End If

End Sub



-------------
Lisa



Print Page | Close Window