Hi.
This is probably an unorthodox silly question perhaps but indulge me. Is there a way to reference an access form parameter in my excel macro if I have the parameter displayed in a cell in Excel? So this way it is passed to the Access macro.
So basically the parameters are "[Forms]![form1]![Month]" and "[Forms]![form1]![Year]".
How would I include these two lines in the excel macro?
I am thinking that I can input my value in a worksheet cell like I mentioned above and call that range in the macro and name it accordingly; however, I do not know how to do that!
End Sub
Thanks.
Ip_123
[FONT="]
[/FONT]
This is probably an unorthodox silly question perhaps but indulge me. Is there a way to reference an access form parameter in my excel macro if I have the parameter displayed in a cell in Excel? So this way it is passed to the Access macro.
So basically the parameters are "[Forms]![form1]![Month]" and "[Forms]![form1]![Year]".
How would I include these two lines in the excel macro?
I am thinking that I can input my value in a worksheet cell like I mentioned above and call that range in the macro and name it accordingly; however, I do not know how to do that!
Code:
Dim MyDatabase As DAO.Database
Dim MyQueryDef As DAO.QueryDef
Dim MyRecordset As DAO.Recordset
Dim i As Integer
Sub Execute_CustRebaccessMcr()
Dim lMsgFilter As Long
Dim A As Object
''' Remove the message filter before calling CustRebateMcr.
CoRegisterMessageFilter 0&, lMsgFilter
Set A = CreateObject("Access.Application")
A.Visible = False
A.OpenCurrentDatabase ("F:\IT DeathofourMi.mdb")
A.DoCmd.RunMacro “sbatequalt"
With MyQueryDef
.Parameters("[[Forms]![form1]![Month]") = Range("C10").Value
.Parameters("[Forms]![form1]![Year]") = Range("C11").Value
CoRegisterMessageFilter lMsgFilter, lMsgFilter
Sheets("User Input").Select
[E16].Select
ActiveCell.Value = Now
[B12].Select
End Sub
Thanks.
Ip_123
[FONT="]
[/FONT]