RE: Adding Customer Inactive check box to National Accounts form.
https://community.dynamics.com/gp/f/32/p/134427/292770.aspx#292770
To run this code you need to add a reference. Mark a reference to a Microsoft Active X Data Object Library in the VBA editor. 1. Open up the VBA editor and go to Tools | References.2. Scroll down until you see the Microsoft Active X Data Object Library. 3.Create a local check box field on Grid.
Screen shots below.
Option Explicit
Public objcon As ADODB.Connection
Dim Rs As New ADODB.Recordset
Dim Ssql1 As String
Public Sub Opencon()
Set objcon = UserInfoGet.CreateADOConnection
objcon.DefaultDatabase = UserInfoGet.IntercompanyID
End Sub
Private Sub Customization_Start()
Call Opencon
End SubPublic Sub Grid_BeforeLinePopulate(RejectLine As Boolean)
Call Opencon
If CustomerNumber.Value <> “” ThenSsql1 = “select inactive from RM00101 where CUSTNMBR='” + CustomerNumber.Value + “‘”
If Rs.State = 1 Then Rs.Close
Rs.Open Ssql1, objcon, adOpenDynamic, adLockOptimistic
acb.Value = (Rs.Fields(0))
End If
End Sub
Filed under: Code Snippit, Dynamics GP, dynamics-gp Tagged: Dynamics GP, Grid, VBA for Dynamics GP

Like
Report

*This post is locked for comments