web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :

Adding Customer Inactive checkbox to National Accounts Form.

Almas Mahfooz Profile Picture Almas Mahfooz 11,009 User Group Leader

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 Sub

Public Sub Grid_BeforeLinePopulate(RejectLine As Boolean)
Call Opencon
If CustomerNumber.Value <> “” Then

Ssql1 = “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

aa

bb


Filed under: Code Snippit, Dynamics GP, dynamics-gp Tagged: Dynamics GP, Grid, VBA for Dynamics GP

This was originally posted here.

Comments

*This post is locked for comments