Hi,
I'm trying to create a macro which uses AccpacGrid, i wanted to add a column which contain a check box or Yes or no option in the column. I can seem find the way to achieve it. Could it be done actually? Any help will be appreciated thanks
This is the way that I do it:
You create a variable to connect to the detail grid and then add a column to the grid. Then add a column and reference the name of an existing field in the view but give the column a different caption:
Set avlDetail = AccpacUI.UIAppControls("avlOEORDDdetail1").GetControl
ColCount = avlDetail.ColumnCount
avlDetail.AddColumn ColCount, "PSPRINTED", 0, kCanShipCaption, ALIGMENT_RIGHT, 100, False, False, True
Then in the OnSetCustomItemData event in the grid you can set the cell value for the current record.
Private Sub avlDetail_OnSetCustomItemData(ByVal bstrColName As String, ByVal bstrFieldName As String, pvBookMark As Variant, bstrData As String, pAccpacDSFields As Object)
On Error GoTo avlDetail_OnSetCustomItemData_Error
If StopCalcOfItemCanShip Then Exit Sub
If CalculatingOrLoading Then Exit Sub
If PostingOrder Then Exit Sub
If bstrFieldName = "PSPRINTED" Then
If bstrColName = kCanShipCaption Then
bstrData = True
If dsORDERDETAIL.Fields("DDTLTYPE").Value = 0 Then
bstrData = True
Else
bstrData = CallGetCanShip
End If
End If
End If
On Error GoTo 0
Exit Sub
avlDetail_OnSetCustomItemData_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure avlDetail_OnSetCustomItemData of Form frmMain"
End Sub
Ok Great. Thanks for your help
*Community Hub is the new name for Sage City