Hi Alex, sorry to address this to you personally but you
seem to be the only person who understands my queries. i
have a form with a calender control. I need to be able to
click on the calender which transfers the selected date to
a textbox (''Date''). This then should automatically then
bring up the record for this date, if no record exists
then a new record is to be created for this date. I am
using the following code but as i am just starting out
with Access i have clearly got this wrong. Any ideas
appreciated.
Private Sub Calendar2_Click()
Me.Date = Me.Calendar2.Value
if isnull(dfirst("Date","Table content","Date=#" &
me.calendar2
& "#") )
'no record. go to new record
DoCmd.GoToRecord , , acNewRec
Else
'position form on record with selected date
Me.RecordsetClone.findfirst "Date=#" & Me.Calendar
& "#"
If Not Me.RecordsetClone.EOF Then
Me.Bookmark = Me.RecordsetClone.Bookmark
End If
End If
End Sub
Thanks in advance
Alex Dybenko - 06 Jul 2004 20:17 GMT
Hi,
code looks almost ok, but few comments:
Me.Date = Me.Calendar2.Value - why do yo uneed this?
if you use DAO then following string:
If Not Me.RecordsetClone.EOF Then
should be
If Not Me.RecordsetClone.nomatch Then
HTH

Signature
Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com
> Hi Alex, sorry to address this to you personally but you
> seem to be the only person who understands my queries. i
[quoted text clipped - 26 lines]
>
> Thanks in advance