View Full Version : Pimary Key as date type, bug finding record


Pedro Pinto
09-20-2006, 06:46 AM
I'm dealling with a problem on positioning a form record by seeking a date primary field.

I have simple table with two data fields:
1st field- date as short-date (table primary field)
2nd field - description as text

Every time i use the method me.recordsetclone.findfirst to match a record by date, if the search date starts with a zero (i.e 02-09-2006) it gives me nomatch but the record exists! If the date doesn't start with zero (i.e 20-09-2006) it matches the record.

How is this possible? Am i doing something wrong? Is there a way to resolve this?

I retreive the search date by clicking on a listbox with the dates records of the table "MyDates"

The code i use is this:

Private Sub List0_Click()

With Me
.RecordsetClone.FindFirst "[MyDates] = #" & me.list0 & "#"
If Not .RecordsetClone.NoMatch Then
.Bookmark = .RecordsetClone.Bookmark
.Recordset.Bookmark = .RecordsetClone.Bookmark
Else
MsgBox ("Record not found")
End If
End With

End Sub

Thank you.

Note: i've tried "dlookup" method and it gives me the same results.

Rich
09-20-2006, 07:26 AM
You'll almost certainly have to use the US date format, there have been numerous posts on the topic that offer solutions