开发者

Click a button on an MS Access form from C# using Access Interop

I can conne开发者_如何学Goct to the access database and run functions etc from c#, I can even get a hold of the button I need to click, but I can't make it think it's been clicked.

 nonManagedDb.DoCmd.OpenForm("frmMaintenance", Access.AcFormView.acNormal, MissingVal, Access.AcFormOpenDataMode.acFormReadOnly, Access.AcWindowMode.acWindowNormal, MissingVal);
            var RunRep = (CommandButton)nonManagedDb.Forms["frmMaintenance"].Controls["btnDailySheetsReport"];

That's as afar as I've gotten with this, I've tried reflection to grab it's event and invoke it but it's classed as a COM object only so that's out.


In Access we can call a procedure in another form using the following syntax:

Call Forms.TransactionTotals.UpdateEmployeeHours

or

Call Forms.OtherTransactionsEntry_VendorInvoices.SetInvoiceID(Me.cboVendorInvoiceID)

Now I doubt you can use similar syntax in .Net but maybe that's enough to figure things out via Interop, etc.

Otherwise if you can run a function then create a one line function in Access whose only job is to call the procedure on a form.

Also a click procedure will be called something like

cmdDeleteTransaction_Click
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜