Search between dates - Type mismatch??

Neilamc

New member
Local time
Today, 00:31
Joined
Feb 25, 2003
Messages
7
Was hoping someone could help with this.

I'm trying to search between two Issue dates in a form using

Where = Where & " AND [DOI] BETWEEN #" + Me![IDStart] + "# AND #" & Me![IDEnd] & "#"

This is converted into a query (QueryDEF):

Set QD = db.CreateQueryDef("Dynamic_Query", "Select * from tblrecords " & (" where " + Mid(Where, 6) & ";"))


While this worked on an early test db I keep getting a 'Type Mismatch' error.

Could this be because I'm using the activeX calendar to update IDStart and IDEnd

Any advice would be appreciated

NM
 
I have had a similar problem to this

Query's cant take the value from the activex calendar

i have 2 solutions

1) this might not work i didnt try this,
change the reference to the atx_calendar to point at the calendar.value property not the calendar

2) this works,
place a textbox with the calendar and place the date from the calendar in that(you can make the box hidden if you want).

Change your query to look at the txt box,

:cool:ShadeZ:cool:
 
Last edited:
Try this:

Add this line just before you create the QueryDef

Debug.Print "Select * from tblrecords " & (" where " + Mid(Where, 6) & ";")


This will "spit" the SQL statement out to the Intermediate (Debug) window.

Copy this statement and paste it into the SQL view of a new query.

This should help you see what is causing the error.
 

Users who are viewing this thread

Back
Top Bottom