Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change Item # entered in VB 1

Status
Not open for further replies.

vbdbcoder

Programmer
Nov 23, 2006
247
US
Sage 300 v2014. Need to put together a simple custom OE screen. When an item is entered, if it is in a list of items, then set the item # field to be a "DefaultItem". I am using Detail View OnRecordChanging event to detect the change, which is good, but I can't set the item # using a value. What did I do wrong? Highly appreciate your input.

Private Sub vDView_OnRecordChanging(ByVal eReason As AccpacCOMAPI.tagEventReason, pStatus As AccpacCOMAPI.tagEventStatus, ByVal pField As AccpacDataSrc.IAccpacDSField, ByVal pMultipleFields As AccpacDataSrc.IAccpacDSFields)
Dim strItem As String
Dim bolItemFound As Boolean

If eReason = RSN_FIELDCHANGE Then
If pField.Name = "ITEM" Then
strItem = pField.UncommittedValue
MsgBox strItem
bolItemFound = ItemExists(strItem) 'check if the item keyed is in the list

If bolItemFound = True Then
MsgBox "Found"
'vDView.Fields("ITEM").Value = "DefaultItem" <--- This line does not work
End If
End If
End If
End Sub
 
Or Alternatively, if the Item # is does not exist, set the item # to be a default Item #. How to enter a different item #?
 
I'd do that in OnRecordChanged. Or, if you're working in OnRecordChanging, try changing the pField value instead of updating the datasource.
 
I can't change the value in pField.UncommittedValue or pField.Value.

The Accpac validation screen prompts to say "Item # does not exist." Is there a way to disable that screen from prompting? I guess not...

Then... I have to change to item # to use a default value, before the prompt, which is in OnRecordChanging event.

Any help is highly appreciated.
 
You can trap that value from the grid, before it heads to the underlying view.

You could also look at View Extender from Orchid. It would allow you to do this without having to modify the screen.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top