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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calendar only works with dialog..

Status
Not open for further replies.

wshs1

Technical User
Jun 22, 2006
23
US
i have a search form which seems to work fine.
user can select name or dates (from and to)to search
for specific log.
one problem. i created a command button which pops a calendar so user can easily click on the dates.
and it works fine. but for some reason, if user manually types in the date, i get a "type mismatch" error...


If Not IsNothing(Me.txtFromDate) Then
varWhere = (varWhere + " AND ") & "[LogDate] >= #" & _
Format(Me.txtFromDate, "dd mmm yyyy") & "#"
End If

If Not IsNothing(Me.txtToDate) Then
varWhere = (varWhere + " AND ") & "[LogDate] < #" & _
Format((Me.txtToDate + 1), "dd mmm yyyy") & "#"
End If


error is occuring on last 2 lines (varwhere = ...)

any idea what im doing wrong?
 
check logdate is in date format.
I don't qiute nderstand the (varWhere + " AND ") part.Are you adding varwhere to the value of the string " AND "?

shouldn't this be (varWhere & " AND ")

breaking the next section down will give you a string of.
"[LogDate] < #"

and I presume you wanted
[logdate] & "< #" &

it may be worth halting the code at this point to see what the varwhere string looks like


Ian Mayor (UK)
Program Error
Programming is 1% coding, 50% error checking and 49% sweat as your application bombs out in front of the client.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top