TinkerMan
Dooh!
- Local time
- Today, 04:26
- Joined
- Jan 12, 2005
- Messages
- 35
HI 
I'm having a strange problem. I found no posts on this, so I guess I'm doing a real rookie mistake.
I have this function (simplified):
This runs fine if it selects from a table or a simple query, but it fails to run against my union query. It gives the error message:
Run-time error '-2147217904 (80040e10)': No value given for one or more required parameters.
The query I want to do a select against is getting its data from a hierarchy of queries:
Query1 gets data from two tables
Query2a and Query2B is a crosstab of Query1 (one for each type)
I then need to do an outer join between the two:
Query3a is a left join of Query2a and Query2b
Query3b is a right join of Query2a and Query2b
Query4 is a union of Query3a and Query3b. (phew)
In addition Query1 uses a date as a constraint, that is coming from a form (that is open when this executes). In addition Query2a and Query2b have this defined as a parameter, so it's passed down to Query1.
I know this query works (Query4) as I can open it manually, and just for kicks I added a subform to my form that was selecting from the same query, and it is showing the data perfectly.
Is there some initialisation I need to do before selecting from this query?
Any help is appreciated
I'm having a strange problem. I found no posts on this, so I guess I'm doing a real rookie mistake.
I have this function (simplified):
Code:
Function someFunction(aDate As Date)
Dim rst As New ADODB.Recordset
Dim rstSQL As String
rstSQL = "SELECT col FROM [query];"
MsgBox rstSQL
rst.Open rstSQL, CurrentProject.Connection , adOpenForwardOnly, adLockPessimistic
MsgBox "Rader= " & rst.RecordCount
End Function
This runs fine if it selects from a table or a simple query, but it fails to run against my union query. It gives the error message:
Run-time error '-2147217904 (80040e10)': No value given for one or more required parameters.
The query I want to do a select against is getting its data from a hierarchy of queries:
Query1 gets data from two tables
Query2a and Query2B is a crosstab of Query1 (one for each type)
I then need to do an outer join between the two:
Query3a is a left join of Query2a and Query2b
Query3b is a right join of Query2a and Query2b
Query4 is a union of Query3a and Query3b. (phew)
In addition Query1 uses a date as a constraint, that is coming from a form (that is open when this executes). In addition Query2a and Query2b have this defined as a parameter, so it's passed down to Query1.
I know this query works (Query4) as I can open it manually, and just for kicks I added a subform to my form that was selecting from the same query, and it is showing the data perfectly.
Is there some initialisation I need to do before selecting from this query?
Any help is appreciated