Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date as Parameter in a Query

Status
Not open for further replies.

tabaki

Programmer
Nov 14, 2001
19
BE
I have a report that gets his information from a query filtered by a form. I filter by changing the query, by changing the parameters. I have succeed to filter by a textfield, but I can't succeed on a datafield (general type: dd/mm/yyyy hh:mm:ss). Always I get error 3075
Please help me

dim FilterString as string
FilterString = " Where TblInterventie.[Einde herstelling])=#" & [Forms]![FrmOproepen]![SubFrmInterventies].[Form]![Einde herstelling] & "#"
SQLstring = SQLstring & FilterString
MakeQueryDef("QRY RPT Afmelding", SQLString)
 




Hi,

When you execute a query that has a Where Clause that equates a Date/Time field to ONE SPECIFIC Date/Time value, in this case to the nearest SECOND, if your field does not contain THAT EXACT Date/Time value, you will get no resultset.

It it more usual to define a RANGE of Date/Time like this...
Code:
FilterString = " Where TblInterventie.[Einde herstelling]) BETWEEN #" & [Forms]![FrmOproepen]![SubFrmInterventies].[Form]![Begin herstelling] & "# AND #" & [Forms]![FrmOproepen]![SubFrmInterventies].[Form]![Einde herstelling] & "#"


Skip,
[sub]
[glasses] When a diminutive clarvoyant had disappeared from detention, headlines read...
Small Medium at Large[tongue][/sub]
 
At what line is the code breaking? Also what is the actual message associated with the error code?

ProDev, Builders of Affordable Software Applications
Visit me at ==>
May God bless you beyond your imagination!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top