Using Recordset

K

K Crofts

Hi
I have a form with a calendar control and have set up a
command button to stabilise selecting a date on the
calender. This works perfectly and the data saves to my
table also, which is great. The problem i have is that
when i exit the programme and re-enter, the form will not
recall the data that has been entered previously, even
though this has definately saved. A collegue of mine has
mentioned using a recordset but this is something i am not
familiar with. how would i use this in my existing
programme? below is my code so far, any ideas greatly
appreciated.

Private Sub GoButt_Click()
If IsNull(DFirst("Date", "Table content", "Date=#" & Format
(Me.Calendar2, "dd\/mmm\/yy") & "#")) Then
'no record. go to new record
Me.Date.SetFocus
DoCmd.GoToRecord , , acNewRec
'here moved line from above
Me.Date = Me.Calendar2.Value
Else
'position form on record with selected date
'Calendar2 used here:
Me.RecordsetClone.FindFirst "Date=#" & Me.Calendar2
& "#"
If Not Me.RecordsetClone.EOF Then
Me.Bookmark = Me.RecordsetClone.Bookmark
End If
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top