Quantcast
Channel: Microsoft Dynamics GP Forum - Recent Threads
Viewing all articles
Browse latest Browse all 14686

VBA

$
0
0

Dear All,

I am writing some vba codes to alert the user that number he/she is putting on Debtor PO number field in Sales Transaction Entry window have been used or not.

Am using sop10100 and sop30200. But my first test only include sop10100.

Unfortunately my codes are not responding to my expectation.

Below is my code

Private Sub DebtorPONumber_AfterGotFocus()
Dim objRec
Dim objConn
Dim cmdString


Set objRec = CreateObject("ADODB.Recordset")
Set objConn = CreateObject("ADODB.Connection")

objConn.ConnectionString = "Provider=MSDASQL;DSN=GP;DataSource=.;Initial Catalog=TWO;User Id=sa;Password=allowme@1"

objConn.Open

'cmdString = "select cstponbr from (select cstponbr from SOP10100 union select cstponbr from SOP30200)a where (a.cstponbr='" + CUSTPONMBR + "')"


Do While Not objRec.EOF

MsgBox "the po" & " " & CSTPONBR & " " & "has been used"

objRec.MoveNext

Loop

objConn.Close

'End If
End Sub

Kindly assists on where am going wrong.

RonRyan


Viewing all articles
Browse latest Browse all 14686

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>