gINT Rules throws error at CallByName

I am beginner learning the gINT Rules .

I am trying follow with the GR001 tutorial at page 97 (Code Samples) First Iteration in the book and apply it against a simple trial code project to see if I could get a sample text placed in the grid. 

I have a table as shown in the image.. 

I have the following rules code [copy and pasteed from gr001 example but with my field and table names] and what I thought were assignment statements in that gr001:

Option Explicit

'Commonly used field names
Public Const gs_Depth As String = "Depth"
Public Const gs_HoleDepth As String = "HoleDepth"
Public Const gs_PointID As String = "PointID"

Public glNumRows As Long
Public gsDataA() As String

Public Function InitFieldsFnB(ParamArray pvFieldsV() As Variant) As Boolean
'05Aug2003 sc
'  Determine the positions of fields in the data array.
'  If any or not found, report the missing field or fields and abort further
'  code execution.
'  pvFieldsV():  Elements 0, 2, 4,... are the field names.
'  pvFieldsV():  Elements 1, 3, 5,... are the field positions.
'  True if fields were not found, False if all were found.
  Const s_FieldSeparator As String = ", "

  Dim iInd As Integer
  Dim iPsField As Integer

  Dim sMissingFields As String

  InitFieldsFnB = False
  sMissingFields = ""
  With gINTRules.GridData
    For iInd = 0 To UBound(pvFieldsV) Step 2
      If iPsField Then
        pvFieldsV(iInd + 1) = iPsField
        sMissingFields = sMissingFields & _
                         s_FieldSeparator & _
      End If
    Next iInd

    If Len(sMissingFields) Then
      sMissingFields = _
        Mid$(sMissingFields, Len(s_FieldSeparator) + 1)
      MsgBox "The following field(s) are missing " & _
             "from this table." & vbCrLf & _
             Space$(5) & sMissingFields & vbCrLf & _
             "Cannot perform the save checks " & _
             "and calcs without it/them." & vbCrLf & _
             "Data will be saved as-is.", _
             vbOkOnly, "Field Checking"
      InitFieldsFnB = True
    End If
  End With
End Function

'#LibInclude "Common"

Option Explicit

Public Sub Main
  With gINTRules.GridData
    'Put the grid data into a working string data array.
    glNumRows = UBound(gsDataA, 2)
    CallByName Me, gINTRules.ProcedureName, vbMethod

    'Put the modified data array back into the input grid.

    'Success is True if there were no errors.
  End With
End Sub

Public Sub Laboratory

Dim iPsDepth As Integer
Dim iPsConfining_Pressure As Integer
Dim iPsDeviator_Stress As Integer
Dim iPsMoisture_Content As Integer
Dim iPsLiquid_Limit As Integer
Dim iPsPlasticity_Index As Integer
Dim iPsWet_Density As Integer
Dim iPsComments As Integer
Dim iPsPP As Integer
Dim iPsM200 As Integer
Dim iPsLab_Tech_Description As Integer

Dim lRow As Long

        With gINTRules.GridData

        iPsDepth = .FieldCol("Depth")
        iPsConfining_Pressure = .FieldCol("Confining Pressure")
        iPsDeviator_Stress = .FieldCol("Deviator Stress")
        iPsMoisture_Content = .FieldCol("Moisture Content")
        iPsLiquid_Limit = .FieldCol("Liquid Limit")
        iPsPlasticity_Index = .FieldCol("Plasticity Index")
        iPsWet_Density = .FieldCol("Wet Density")
        iPsComments = .FieldCol("Comments")
        iPsPP = .FieldCol("PP")
        iPsM200 = .FieldCol("-200")
        iPsLab_Tech_Description = .FieldCol("Lab Tech Description")

          For lRow = 1 To glNumRows
          'just trying to put the text into the Comments Field
          gsDataA(iPsComments, lRow) = "Test Data"
          Next lRow
        End With
       End Sub

The Tables are shown in the screen grab

Click image to get it to expand to show the fields I am working with ...

The error is in the line "CallByName Me, gINTRules.ProcedureName, vbMethod"   .. when I try to run the code it says "(10091) ActiveX Automation: no such property or method. No Pre- or Post-process code specified for table LABORATORY"

Am I missing some hidden fields or key fields Do I need Point ID? Confused as to why it breaks. Also Dont think I need the field names check function at this point, right?

Maybe I need a gINTRules.GridData.DataValue (Col, Row) = "My testing text here"???

  • Hi Art,

    Check to make sure that you have set the References correctly for your Common Procedures module.

    Select the gINT Rules Code command.

    Select your "common" procedures module from the List tab.

    Then, click on the Code tab followed by the References command from the Edit menu.

    Make sure that you have selected the correct DAO (Access Database Engine Object) library for the version of Microsoft Office installed on your computer.

    For example, I ran MS Office 2003 for many years on a Windows 7 system and I would need to select "Microsoft DAO 3.6 Object Library (5.0).

    Now I am running MS Office 365 (Office 16) on a Windows 10 system and I need to select "Microsoft Office 16.0 Access Database Engine Object Library (c.0)".

    Hope that helps get you further along.




    SMH at Myself   .. I recall now that I copied the code segments from the Example and FORGOT no DUH! to check the references because they do not copy over with the code   SMH... Embarrassed

    Let me check what is there.



    I will check this out ... Not sure if it will do the trick because I ran the sample procedrue gR001 to see if what that example did would run. After I confirmed that the sample itself ran, then I started stripping things out just to see if I could  make a skeleton to load the current table into the recordset, then write a test value back to the recordset where it would show up as aq changed value  in the cell that in the table. 

    In that Sub Laboratory that I gave up above . the lines ...

    For lRow = 1 To glNumRows

    'just trying to put the text into the Comments Field
    gsDataA(iPsComments, lRow) = "Test Data"

    encapsulates the simple attempt to write this string to the table.. but no joy

  • Still No Joy..

    Here are the images of what is coming up and what Reference I have checked in both common and in the specific rule module. Im WIn 10 Office 365

  • Hi Art,

    I just copied your code examples into 2 new modules in a copy of the GR001 library file. I made no modifications to them.

    I recognized that you were using a copy of the TX DOT project file so I copied the Laboratory table to a copy of the GR001 project file and added your additional fields.

    The code works just fine the way you had written it so far.

  • DId you run from the IDE within the Sub Laboratory or did you fire it from a change tab or save on exit etc event..

  • Hi Art,

    I set the procedure to run on the "gINT Rules Procedure on Save" event, which is the most common and I assumed that was what you were wanting to do.

    To test it, I just deleted a value in one of the fields in the first record which then triggers the "on save" event and then saved the changes. The "Comments" field was then populated with the "Test Data" text that you had hard coded into the procedure.

    I then repeated that for a second record.

    Answer Verified By: Art Koenig 

  • This was great information.. I ran it via making it an AddIn and it worked as expected... It did not run from the IDE which I was using to try and test things. Thanks so much for your interest in this hurdle I was having.. Apparently you cannot run to test from the gint rules IDE

Reply Children
  • I wouldn't have run it as an AddIn, I use the AddIn option when I need to add a custom menu item for a client to facilitate, say, importing or exporting data. Many times you cannot just use a Correspondence File and the Import or Export command to import or export data. In many cases, the source file is not setup to allow the use of a Correspondence File and therefore a gINT Rule is needed to read the data from the source file and to then put the data in the appropriate tables in the gINT project database. The same can be true when exporting to a file.