Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / November 2006

Tip: Looking for answers? Try searching our database.

fldName

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bill H. - 04 Nov 2006 02:50 GMT
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.

Signature

Bill

Stefan Hoffmann - 04 Nov 2006 12:40 GMT
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 <--
Bill H. - 04 Nov 2006 19:41 GMT
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."

> hi Bill,
>
[quoted text clipped - 10 lines]
> mfG
> --> stefan <--
Douglas J. Steele - 04 Nov 2006 15:06 GMT
"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)

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)

> Why doesn't this work?
>
[quoted text clipped - 19 lines]
>
> Thx.
Bill H. - 04 Nov 2006 20:48 GMT
I did try that, but apparently not it all places, for it now works.

Thanks!

> "Field" is an object in both the ADO and DAO models.
>
[quoted text clipped - 5 lines]
> Error, Errors, Field, Fields, Parameter, Parameters, Property, Properties
> and Recordset)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.