Re: Dynamic WHERE statement or criteria
- From: "David C. Holley" <DavidCHolley@xxxxxxxxxxxx>
- Date: Tue, 01 Nov 2005 13:30:43 -0500
When you have a parameter in a query, SET the .PARAMETER object variable before opening the RecordSet.
David wrote:
This is SO frustrating, as I did this ages ago, but have since lost the code and I've been trawling the internet all day.
All I want to do is pass an argument to a select query. The field name is 'Authority Type', in table 'Authority'. I'm positive there was a docmd function or something similar. I tried using .parameter(), but don't quite get how that works. I stuck some dummy criteria in the query, but the parameter.count value never showed more than 0. Is a parameter something else entirely? RETARDED.
Is there not something like qdf.execute(Where options) or something???? I just need to pass the field name and lookup value!!!
Dim stDocName As String
Dim db As Database
Dim rs As DAO.Recordset
Dim qdf As QueryDef
Set db = CurrentDb
Set qdf = db.QueryDefs("Authorities") 'Authorities is a basic two-field query
Set rs = qdf.OpenRecordset
Do While rs.EOF = False
thisAuthority = rs(1).Value
MsgBox thisAuthority
rs.MoveNext
Loop
.
- Prev by Date: Re: Validate data value within two data Fields
- Next by Date: Re: Trying to calculate the change from a value in one row from anothe
- Previous by thread: Re: Validate data value within two data Fields
- Next by thread: Re: Trying to calculate the change from a value in one row from anothe
- Index(es):
Relevant Pages
|