I didn't have that problem so I'm thinking it may be because of the nature of the UD table. I am just guessing here, but you may have to create the foreign key view using all 5 key fields of the UD table. When creating the FKV, try mapping the unused key fields to an unused character field in the part table. I'm relying on my faulty memory here, but I seem to recall something about haveing to use all key fields when creating a FKV to a UD table.
________________________________
From: melissa hietala <
kevmel822@...>
To:
vantage@yahoogroups.com
Sent: Friday, December 19, 2008 3:26:58 PM
Subject: Re: [Vantage] User Defined Tables
Steven -
Thanks for your response! I was able to use bits and pieces of your code and I think I'm getting close but I'm still having an issue.. I first created a FKV of the Part table to the UD01 table. I then am using the following code inserted below. The problem arises in that when I enter a number into the UD01.Key1 field, the code entered in the "AfterFieldChange" event is triggered before the FKV part field is updated. I need to have this code look at the FKV value at the appropriate time. Any ideas!?!?
Thanks!!!
Dustin Biniek
UMC, Inc.
DustinB@ultramc. com
Private Sub UD01_AfterFieldChan ge(ByVal sender As object, ByVal args As DataColumnChangeEve ntArgs) Handles UD01_Column. ColumnChanged
  '// ** Argument Properties and Uses **
  '// args.Row("[FieldNam e]")
  '// args.Column, args.ProposedValue, args.Row
  '
  'Add Event Handler Code
  '
    Dim edvTest As EpiDataView = CType(oTrans. EpiDataViews( "Test" ), EpiDataView)
         Â
       Select Case args.Column. ColumnName
Â
   Case "Key1"
          If edvTest.HasRow then
          Messagebox.show( "There is a valid part")
          Else Messagebox.show( "Invalid Part #")
          End If
  Â
           Case Else
Â
  End Select
Â
 End Sub
End ModuleÂ
____________ _________ _________ __
From: Steven Gotschall <sgotschall@yahoo. com>
To: vantage@yahoogroups .com
Sent: Thursday, December 18, 2008 2:49:11 PM
Subject: Re: [Vantage] User Defined Tables
I haven't tried this with a UD table, but I do have a customization for Sales Order Entry that checks the part table and only allows parts to be entered into the Sales Order that is in the part table. First you have to create a foreign view to the part table. The custom code I have does other things, but here is the code and you should be able to pick out the parts you need:
 Private Sub OrderDtl_AfterField Change(ByVal sender As object, ByVal args As DataColumnChangeEve ntArgs) Handles OrderDtl_Column. ColumnChanged
  '// ** Argument Properties and Uses **
  '// args.Row("[FieldNam e]")
  '// args.Column, args.ProposedValue, args.Row
  '
  'Add Event Handler Code
  '
Â
  Dim edvPartInfo As EpiDataView = CType(oTrans. EpiDataViews( "PartInfo" ), EpiDataView)
  Dim NonStockItem As Boolean
  If edvPartInfo. HasRow then
   NonStockItem = edvPartInfo. dataView( edvPartInfo. Row)("NonStock" )
  Else
   NonStockItem = False
  End If
Â
  Select Case args.Column. ColumnName
Â
   Case "PartNum"
    If NonStockItem and (Args.row("Availabl eQuantity" ) > 0) then
     if Not(IgnorePNCFlag) then MsgBox(args. row("PartNum" ) & " is a NonStock Item with " & Args.row("Available Quantity" ) & " available in Stock", 64, "NonStock Part With Available Quantity")
     args.row("CheckBox1 9") = True
     args.row("CheckBox2 0") = True
     IgnorePNCFlag = False
    ElseIf Not(edvPartInfo. .HasRow) and Not(IgnorePNCFlag) then
     MsgBox(args. row("PartNum" ) & " Does not exist in the Part Master Table. Please enter a new Item or use the Product Configurator" , 16, "Invalid Part Number")
     IgnorePNCFlag = True
     if len(OrigPartNum) > 0 then
      args.row("PartNum" ) = OrigPartNum
     Else
      args.row("PartNum" )=""
     End If
    Else
     args.Row("CheckBox1 9") = NonStockItem
     args.row("CheckBox2 0") = False
     IgnorePNCFlag = False
    End If
    Args.row("Number02" ) = 0..0
    if (args.row("UnitPric e") <> args.row("Number01" )) and (trim(args.row( "ShortChar01" ))="" or trim(args.row( "ShortChar01" ))="Finished Good") then args.row("Number02" ) = 1.0
    If (args.row("UnitPric e") = 0 or args.row("Number01" )=0) And (trim(args.row( "ShortChar01" ))="" or trim(args.row( "ShortChar01" ))="Finished Good") then Args.row("Number02" ) = 2.0
   Case "UnitPrice", "DocUnitPrice"
    Args.row("Number02" ) = 0.0
    if (args.row("UnitPric e") <> args..row("Number01" )) and (trim(args.row( "ShortChar01" ))="" or trim(args.row( "ShortChar01" ))="Finished Good") then args.row("Number02" ) = 1.0
    If (args.row("UnitPric e") = 0 or args.row("Number01" )=0) And (trim(args.row( "ShortChar01" ))="" or trim(args.row( "ShortChar01" ))="Finished Good") then Args.row("Number02" ) = 2.0
   Case "SellingQuantity"
    Args.row("Number02" ) = 0.0
    if (args.row("UnitPric e") <> args.row("Number01" )) and (trim(args.row( "ShortChar01" ))="" or trim(args.row( "ShortChar01" ))="Finished Good") then args.row("Number02" ) = 1.0
    If (args.row("UnitPric e") = 0 or args.row("Number01" )=0) And (trim(args.row( "ShortChar01" ))="" or trim(args.row( "ShortChar01" ))="Finished Good") then Args.row("Number02" ) = 2.0
   Case Else
    IgnorePNCFlag = False
  End Select
Â
 End Sub
____________ _________ _________ __
From: melissa hietala <kevmel822@yahoo. com>
To: vantage@yahoogroups ..com
Sent: Thursday, December 18, 2008 11:32:23 AM
Subject: [Vantage] User Defined Tables
I'm just starting to look at user defined tables. What I would like to do is
use the table "UD01" and create a form based off this table.. I am able to get
the form created, but what I need to do is have the primary key (Key1) for the
user defined table be equal to an existing part in the system. So when a new
record is created in the user defined table, Key1 needs to match an existing
part in the system, if there isnt a matching part in the system I would need an
error message that would prevent the record from being created. Has anyone
attempted to do something like this? Any ideas?
Â
Thanks,
Dustin Biniek
UMC, Inc.
DustinB@ultramc. com
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]