There have been LOTS of postings about error 3061, but mine seems to
be an even simpler case than the others. I have a simple
**FUNCTIONING** query called qryEdits. Copying the SQL from the query,
it reads:
SELECT Edits.Pattern, Edits.From, Edits.To
FROM Edits
WHERE (((Edits.Language)=[Forms]![frmDialog].[lstLanguage]));
The idea is to select just the language-appropriate records from the
Edits table. This works great when I run it alone. However when I try
to query this in DAO code, I get the Error 3061. My DAO code reads as
follows:
Dim dbCurrent As Database ' PFM
Dim qryEdits As QueryDef ' Where we keep qryEdits.
Dim rsqryEdits As Recordset ' The qryEdits recordset.
' lots of code in here
If Paragraphs& <> 0 Then ' Get the edits ready.
Set dbCurrent = CurrentDb()
Set qryEdits = dbCurrent.QueryDefs("qryEdits")
Set rsqryEdits = qryEdits.OpenRecordset
This last line is the one that gives me the 3061 error.
Thanks in advance for any thoughts, ideas, suggestions,
commizerations, castigations, curses, etc?
Steve Richfield
Bas Cost Budde - 08 Nov 2004 21:14 GMT
The VBA environment cannot find the parameter--even if it sits right
there in a form. You have to pass it manually. I inserted a code line
that should do the trick, but I'm not sure about the notation of the
parameter name.
> Dim dbCurrent As Database ' PFM
> Dim qryEdits As QueryDef ' Where we keep qryEdits.
[quoted text clipped - 5 lines]
> Set dbCurrent = CurrentDb()
> Set qryEdits = dbCurrent.QueryDefs("qryEdits")
qryEdits.Parameters("lstLanguage")=[Forms]![frmDialog].[lstLanguage]
> Set rsqryEdits = qryEdits.OpenRecordset
Saintor - 09 Nov 2004 02:31 GMT
"SELECT * FROM Edits WHERE Edits.Language='" &
[Forms]![frmDialog].[lstLanguage] & "';"
> There have been LOTS of postings about error 3061, but mine seems to
> be an even simpler case than the others. I have a simple
[quoted text clipped - 27 lines]
>
> Steve Richfield