Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics SL (Archived)

Issue extending Inventory table

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello, I'm attempting to add some custom fields to Inventory Status Inquiry / Costs form. I'm following the following article that I found which I think should work.

http://dynamicserppros.com/adding-additional-user-fields-microsoft-dynamics-sl-screen/

I added the extension table, module and added code to the code behind. But when I save I get a message that the VBA would not compile. Also when attempting to add controls on the form the extended fields are not available to bind the controls.

I'm new to SL and not sure what I've done wrong so I'm attaching my code.

Please help me get this modification working or point me in the right direction.

Table:

CREATE TABLE [dbo].[xInventoryExt](

[User9] [float] NOT NULL,

[User10] [float] NOT NULL,

[User11] [float] NOT NULL,

[User12] [float] NOT NULL,

[User13] [int] NOT NULL,

[User14] [int] NOT NULL,

[User15] [int] NOT NULL,

[User16] [int] NOT NULL,

[InvtID] [char](30) NOT NULL,

[tstamp] [timestamp] NOT NULL,

CONSTRAINT [xInventoryExt0] PRIMARY KEY CLUSTERED

(

[InvtID] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

) ON [PRIMARY]

 

Module:

Type xInventoryExt

 User9 As Double
 User10 As Double
 User11 As Double
 User12 As Double
 User13 As Integer
 User14 As Integer
 User15 As Integer
 User16 As Integer
 InvtID As String

End Type


Public bxInventoryExt As xInventoryExt, nxInventoryExt As xInventoryExt

Costs code behind:

Private Sub f1022002_Display()

End Sub

Private Sub f1022002_Load()

Call VBA_SetInventoryCosts("bxInventoryExt", bxInventoryExt, LenB(bxInventoryExt))

Call SqlCursorEx(cursor_xInventoryExt, NOLEVEL, "cursor_xInventoryExt", "xInventoryExt", "xInventoryExt")

End Sub

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

Dim sqlStatement As String

sqlStatement = "Select * from xInventoryExt Where InvtID = " & SParm(ChkStrg)

serr1 = SqlFetch1(cursor_xInventoryExt, sqlStatement, bxInventoryExt, LenB(bxInventoryExt))

    If serr1 = NOTFOUND Then

        bxInventoryExt = nxInventoryExt
        bxInventoryExt.InvtID = ChkStrg

    End If

Call DispFields("", "")

End Sub

Private Sub Update1_OnUpdate(level As Integer, InsertFlg As Integer, retval As Integer)

Dim InvtID As String
Dim SqlStr As String

InvtID = GetObjectValue("cInvtID")

If level = 0 Then

    SqlStr = "Select * from xInventoryExt where InvtID = " & SParm(InvtID)

    serri = SqlFetch1(CSR_XVendorExt, SqlStr, bxInventoryExtLookup, LenB(bxInventoryExtLookup))

     If serr1 = 0 Then

        Call SUpdate1(CSR_xInventoryExt, "xInventoryExt", bxInventoryExt, LenB(bxInventoryExt))

    Else
       
        bxInventoryExt.InvtID = InvtID

        Call SInsert1(cursor_xInventoryExt, "xInventoryExt", bxInventoryExt, LenB(bxInventoryExt))

    End If

End If


End Sub

 

 

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Issue extending Inventory table

    it might be as simple fixing the form load event:

       Call VBA_SetAddr("bxInventoryExt", bxInventoryExt, nxInventoryExt, LenB(bxInventoryExt))
       Call SqlCursorEx(csr_xInventory, NOLEVEL + SqlUpdate, "cursor_xInventoryExt", "xInventoryExt", "xInventoryExt")

    To add the fields to the screen, but I don't think your update code will work on the Inquiry screen. 

    Thanks,

    Ayrin

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,307 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans