smartstream 11/17/2013 3:17:13 AM

VB Code for an Extender window

Hi we have an Extender window that we only want to pop up when certain Accounts are enter in a GJ; The criteria is based on Account Categories;

The VB Code that was written by some consultants is

'Create a command to select all customers
linecounttxt.ActiveConnection = cn
linecounttxt.CommandType = adCmdText

linecounttxt.CommandText = "SELECT dbo.GL00100.ACCATNUM AS ACCATNUM FROM dbo.GL00100 "INNER JOIN dbo.GL00105 ON dbo.GL00100.ACTINDX = dbo.GL00105.ACTINDX WHERE dbo.GL00105.ACTNUMST = '" & AccountNumber & "' "

Set rst = linecounttxt.Execute
catnumber = rst!ACCATNUM
 
'check that the right cat is selected and popup extender screen

If catnumber >= 100 And catnumber <= 106 Then
    SendKeys "^a"
Else
    If catnumber >= 225 And catnumber <= 229 Then
        SendKeys "^a"
    Else
        If catnumber >= 315 And catnumber <= 318 Then
            SendKeys "^a"
        Else
            If catnumber = 300 Then
               SendKeys "^a"
            Else
            End If
        End If
       
    End If
End If

End Sub

However what happens is the window comes up regardless of the account selected; I have conformed the data at a SQL level is correct (ie the ACCATNUM in GL00100) is correct.

Any ideas what is wrong?

Many thanks

 

 

Version: GP 2013
Section: Dynamics GP, VBA


Table Definition Quick Links
All Tables
SOP Tables
RM Tables
GL Tables
POP Tables
HR Tables
PM Tables
UPR Tables
IV Tables
Olympic Tables
3