Hi, I've been following instructions on this topic from "MS Access 2000 Power Programming: the authoritative solution" p. 162", but I can't get the #$%& code to work when the parameter is text as opposed to numeric. My code is below, and your comments are appreciated!!
Dim appExcel As New Excel.Application
Dim wkbExcel As Excel.Workbook
Dim wkshtExcel As Excel.Worksheet
Dim rngExcel As Excel.Range
Dim rs As New ADODB.Recordset
Dim catCurr As New ADOX.Catalog
Dim cmdcurr As New ADODB.Command
'The code below comes out of "MS Access 2000 Power Programming: the authoritative solution" p. 162 - how to open up a recordset off a parameterized query.
catCurr.ActiveConnection = CurrentProject.Connection
Set cmdcurr = catCurr.Procedures("REVIEW ARQni Personnel SW allocations").Command
'The code below that defines the parameter does not work in the current form, although I've gotten it to work to run it off a numeric field. The example in the book uses a date. Ideally, I would like to define the parameter by linking it to data entered in a form (e.g. forms![form name]![control name]. The parameter [enter unqid] is defined in the query criteria.
cmdcurr.Parameters("[Enter UNQID]") = "5L07"
rs.Open cmdcurr, , adOpenKeyset, adLockReadOnly, adCmdStoredProc
Dim appExcel As New Excel.Application
Dim wkbExcel As Excel.Workbook
Dim wkshtExcel As Excel.Worksheet
Dim rngExcel As Excel.Range
Dim rs As New ADODB.Recordset
Dim catCurr As New ADOX.Catalog
Dim cmdcurr As New ADODB.Command
'The code below comes out of "MS Access 2000 Power Programming: the authoritative solution" p. 162 - how to open up a recordset off a parameterized query.
catCurr.ActiveConnection = CurrentProject.Connection
Set cmdcurr = catCurr.Procedures("REVIEW ARQni Personnel SW allocations").Command
'The code below that defines the parameter does not work in the current form, although I've gotten it to work to run it off a numeric field. The example in the book uses a date. Ideally, I would like to define the parameter by linking it to data entered in a form (e.g. forms![form name]![control name]. The parameter [enter unqid] is defined in the query criteria.
cmdcurr.Parameters("[Enter UNQID]") = "5L07"
rs.Open cmdcurr, , adOpenKeyset, adLockReadOnly, adCmdStoredProc