Re: Datetime-fields in Access - Crystal Reports
Posted in 1998
Albert Geisser wrote: > Has anybody any experience with Informix SQL and MS Access/ Crystal > Reports in handling datetime-fields? > I'm having troubles to select over datetime fields. > > How to selcet in Access or Crystal-Reports? > If you are coding SQLpassthrough select statements you must format your datetime field with format (datum_a,"yyyy-mm-dd hh:nn:ss") and enclose its formatted value in single quotes. Otherwise if you are using the Jet Engine you must format it with the same format and enclose it with # i.e 1)SQLPassThrough: SQLstr = "SELECT * FROM tablea WHERE datum_feld = ' " & format(Me!datum_feld, "yyyy-mm-dd hh:nn:ss") & "'" Set rs = ODBCdb.OpenRecordset(SQLstr, dbOpenSnapshot, dbSQLPassThrough) 2) Jet Engine SQLstr = "SELECT * FROM tablea WHERE datum_feld = # " & format(Me!datum_feld, "yyyy-mm-dd hh:nn:ss") & "#" Set rs = mydb.OpenRecordset(SQLstr, dbOpenSnapshot) HTH Tolis Varnas -- V+K Relational Solutions mailto:tvarnas@compulink.gr Deligiorgi 26 mailto:tvarnas@orbit.de 546 42 Thessaloniki Voice: +30-31-820270 Greece Fax: +30-31-865463