469,322 Members | 1,822 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,322 developers. It's quick & easy.

Pimary Key as date type, bug finding record

I'm new at access and i'm dealling with a simple problem on positioning the form record seeking a date primary field.

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

Every time i try to use a me.recordsetclone.findfirst to match a date starting 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 wronge?

I retreive the dates from clicking in a listbox and it's rowsource is the date field from 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.
Sep 20 '06 #1
1 1253
MMcCarthy
14,534 Expert Mod 8TB
Although you see the date with a 0 this is a format not a value the value is only the 2 not the 02.

To find a date less than the 10th of the month use

Day([DateField])<10


I'm new at access and i'm dealling with a simple problem on positioning the form record seeking a date primary field.

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

Every time i try to use a me.recordsetclone.findfirst to match a date starting 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 wronge?

I retreive the dates from clicking in a listbox and it's rowsource is the date field from 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.
Sep 21 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by Dominique Javet | last post: by
reply views Thread by oneplace | last post: by
1 post views Thread by Presto | last post: by
reply views Thread by Gurmeet2796 | last post: by
reply views Thread by mdpf | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.