I'm trying to retrieve a value from a query and put this on a form.
In order to do so I've build a query that provides me with the correct data. When I put the query to work in VBA it provides me with error 3061, to few parameters.
Any clues?
In order to do so I've build a query that provides me with the correct data. When I put the query to work in VBA it provides me with error 3061, to few parameters.
Code:
strSQL1 = "SELECT DISTINCT TOP 1 [TotalExpenses]+[InvoiceDefaultHire]+[WorkDays]*[InvoiceDefaultEmpCost] AS TotalInvoiceValue, " & _
"queExpSum.TotalExpenses, queInvoiceWorkDays.WorkDays, tblInvoice.InvoiceDefaultHire, tblInvoice.InvoiceDefaultEmpCost, " & _
"[WorkDays]*[tblInvoice]![InvoiceDefaultEmpCost] AS InvoiceWorkCost FROM tblInvoice, queExpSum, queInvoiceWorkDays;"
Set dbs = CurrentDb
Set rstInvoiceTotal = dbs.OpenRecordset(strSQL1)
If Not (rstInvoiceTotal.BOF And rstInvoiceTotal.EOF) Then
rstInvoiceTotal.MoveFirst
Me!InvoiceValue.Value = rstInvoiceTotal!TotalInvoiceValue
End If
Any clues?