Recordset issues referencing controls in subform.

js061256

Registered User.
Local time
Today, 00:03
Joined
Oct 13, 2014
Messages
10
I've been trying for days without success to do what should be a simple thing: double click a field in a subform and paste the query results into excel. I already have good code to paste in the recordset, but this recordset must reference a control value in a subform. The query works and shows the proper results manually, but when I run the Sub it throws a "run-time error 3061: Too few parameter. Expected 1."

I can't seem to set the parameters right. Tried EVERYTHING--except the RIGHT thing.:banghead:
 
Sorry, Here's what I have so far:

Private Sub Batch_DblClick(Cancel As Integer)
Dim XL As Excel.Application, wbTarget As Workbook
Dim qdfResults As QueryDef
Dim rsResults As DAO.Recordset

Set XL = New Excel.Application
Set wbTarget = XL.Workbooks.Open("G:\XE_ECMs\IPP Sharing Development\Templates\IPPCheckResultsRequestForm.xlsm")

Set qdfResults = CurrentDb.QueryDefs("BatchOutQ")
Set rsResults = qdfResults.OpenRecordset()
XL.Visible = True
wbTarget.Sheets("IPP_Request").Range("A5").CopyFromRecordSet rsResults
End Sub

Please Obe Wan; you're my only hope!
 
Thanks for that. I added the reference before opening the recordset using the same syntax as the sample shows:

Set qdfResults = CurrentDb.QueryDefs("BatchOutQ")
qdfResults![Forms!BatchesOpenF!Batch] = Forms![BatchesOpenF]![Batch]
Set rsResults = qdfResults.OpenRecordset()

But now Access can't find the referenced form. This has got to be about brackets or the control the subform is in, doesn't it?
 

Users who are viewing this thread

Back
Top Bottom