The following vb code opens up a database form at a specific record. I would then like to run the event procedure that is attached to a button on the form. I have tried creating a Macro that runs the procedure, but when running the vb script, it says the procedure cannot be found. I have even tried changing the event procedure from private to public with no avail. I have also even tried just putting the name of the procedure instead of the Macro1 and still a no go. What could I possibly be missing.
Here is the vb Script:
Set accessApp = CreateObject("Access.Application")
accessApp.OpenCurrentDataBase "M:\Shared Documents\Job Cost Analysis\TRAINING JOBCOST ANALYSIS DATABASE\Job_Cost_Analysis_Tracking_Training.accdb", false
accessApp.visible = true
accessApp.UserControl = true
accessApp.DoCmd.OpenForm "frmClients", , , "Clients!client_id= 100005 ", , acWindowNormal, True
accessApp.Forms("frmClients").status_ID=3
accessApp.Run "cmdImportItemStmt_Click"
accessApp.Forms("frmClients").status_ID=34
accessApp.Save
Here is the procedure in access:
Private Sub cmdImportItemStmt_Click()
On Error GoTo Problems
Dim filename As String
'***** CHECK TO MAKE SURE STATUS IS IN ITEMIZED STATEMENT IMPORT ***********
If Me.status_ID.Column(1) = 3 Then
If IsNull(Me.frmItemizedStmtTotals("AMT DISPUTED").Value) = True Then
filename = (copyQueue & "CLIENT_" & CStr(Me.client_ID.Value) & "\Client_" & CStr(Me.client_ID.Value) & ".xlsx")
DoCmd.TransferSpreadsheet acLink, acSpreadsheetTypeExcel12, "Sheet1", filename, True
DoCmd.SetWarnings (WarningsOff)
'**********APPEND ITEMIZED STATEMENT***********
DoCmd.OpenQuery "append_itemized_stmt_import"
'**********UPDATE ITEMIZED STATEMENT W/ REASON CODES***********
DoCmd.OpenQuery "Update_reason_codes_by_desc_null_revcodes"
DoCmd.OpenQuery "Update_reason_codes_by_desc"
'************** If facility is OHSU remove non-billable items per contract**********
If Me.facility_ID = 102 Then
DoCmd.OpenQuery "qryOHSU_nonbillable"
End If
'**************************************************************
Me.frmISAmtsByRevenueCodes.Requery
Me.frmItemizedStmtTotals.Requery
DoCmd.DeleteObject acTable, "Sheet1"
DoCmd.SetWarnings (WarningsOn)
Else
MsgBox "UNABLE TO IMPORT IS RECORDS BECAUSE THE ITEMIZED" & vbCrLf & _
"STATEMENT'S TOTAL BILLED CHARGES ALREADY HAS A" & vbCrLf & _
"BALANCE > THAN ZERO INDICATING A PREVIOUS IMPORT", vbOKOnly, "UNABLE TO IMPORT IS RECORDS"
End If
Else
MsgBox "INACCURATE CLAIM REVIEW STATUS" & vbCrLf & _
"FOR ITEMIZED STATEMENT IMPORT", vbOKOnly, "INACCURATE CLAIM REVIEW STATUS"
End If
RecalculateTotals
Exit Sub
Problems:
Err.Clear
Resume Next
End Sub

Submust be declared asPUBLICaccessApp.Run "Macro1"you trying to run procMacro1not yourscmdImportItemStmt_Click()