fldName

B

Bill H.

Why doesn't this work?

the query produces results with one of the fieldnames as DateDone and whose
values are dates. I'm trying to get a fieldname that looks like the dates in
the DateDone field (I'll use in a create table SQL later).

Dim fldDateAttended as Field, rs as DAO.Recordset, db as Database,
qdf as QueryDef
Set db = Currentdb()
Set qdf = db.QueryDefs("Qry_04")
qdf.Parameters("mWorkshopID") = mWorkshopID
Set rs = qdf.OpenRecordset(dbReadOnly)

Set fldDateDone = rs("DateDone")

I get a data type mismatch when execution gets to the set fldDateDone line.
I'd expect the fldDateDone to be the first record in the query, as in
"11/1/2006"


Thx.
 
S

Stefan Hoffmann

hi Bill,
Dim fldDateAttended as Field
Declare it also as DAO.Field.
Set fldDateDone = rs("DateDone")
I get a data type mismatch when execution gets to the set fldDateDone line.
Avoid default values, cause i think your rs() returns the value of the
field. Try the explicit syntax instead:

Set fldDateDone = rs.Fields.Item("DateDone")


mfG
--> stefan <--
 
D

Douglas J. Steele

"Field" is an object in both the ADO and DAO models.

Try:

Dim fldDateAttended as DAO.Field

(The list of objects with the same names in the 2 models is Connection,
Error, Errors, Field, Fields, Parameter, Parameters, Property, Properties
and Recordset)
 
B

Bill H.

Hm. Not sure what you mean by "returns the value of the field."

That is what I want (I think). I want the values that are in the table with
the field named "DateDone."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top